From 32d17447a258188b2d534bcb0bf65a659ba7b7d0 Mon Sep 17 00:00:00 2001 From: mcentner Date: Fri, 29 Aug 2008 12:11:34 +0000 Subject: Initial import. git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/keystore.ks | Bin 0 -> 5635 bytes BKUApplet/pom.xml | 117 +++++++++ BKUApplet/src/main/java/META-INF/MANIFEST.MF | 3 + .../at/gv/egiz/bku/online/applet/BKUApplet.java | 101 ++++++++ .../at/gv/egiz/bku/online/applet/BKUWorker.java | 286 +++++++++++++++++++++ .../online/applet/InternalSSLSocketFactory.java | 101 ++++++++ .../applet/InternalSSLSocketFactoryException.java | 45 ++++ .../gv/egiz/bku/online/applet/Messages.properties | 58 +++++ .../egiz/bku/online/applet/Messages_de.properties | 42 +++ .../at/gv/egiz/bku/online/applet/images/logo.png | Bin 0 -> 4035 bytes .../at/gv/egiz/stal/client/STALServiceTest.java | 96 +++++++ 11 files changed, 849 insertions(+) create mode 100644 BKUApplet/keystore.ks create mode 100644 BKUApplet/pom.xml create mode 100644 BKUApplet/src/main/java/META-INF/MANIFEST.MF create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java create mode 100644 BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties create mode 100644 BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties create mode 100644 BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png create mode 100644 BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java (limited to 'BKUApplet') diff --git a/BKUApplet/keystore.ks b/BKUApplet/keystore.ks new file mode 100644 index 00000000..824c3a40 Binary files /dev/null and b/BKUApplet/keystore.ks differ diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml new file mode 100644 index 00000000..35672e51 --- /dev/null +++ b/BKUApplet/pom.xml @@ -0,0 +1,117 @@ + + + + bku + at.gv.egiz + 1.0-SNAPSHOT + + 4.0.0 + at.gv.egiz + BKUApplet + BKU Applet + 1.0-SNAPSHOT + + + + + maven-dependency-plugin + + + unpack + + unpack + + + ${project.build.outputDirectory} + META-INF\/ + + + at.gv.egiz + smcc + jar + + + at.gv.egiz + smccSTAL + jar + + + at.gv.egiz + STAL + jar + + + at.gv.egiz + STALService + jar + + + at.gv.egiz + BKUCommonGUI + jar + + + + + + + + maven-jar-plugin + + + + sign + + + + + + false + false + + false + true + + + test-applet signer + ./keystore.ks + storepass + keypass + true + + + + + + + at.gv.egiz + smcc + 1.0-SNAPSHOT + + + at.gv.egiz + STAL + 1.0-SNAPSHOT + + + at.gv.egiz + STALService + 1.0-SNAPSHOT + + + at.gv.egiz + smccSTAL + 1.0-SNAPSHOT + + + at.gv.egiz + BKUCommonGUI + 1.0-SNAPSHOT + + + commons-logging + commons-logging + + + \ No newline at end of file diff --git a/BKUApplet/src/main/java/META-INF/MANIFEST.MF b/BKUApplet/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 00000000..5e949512 --- /dev/null +++ b/BKUApplet/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + 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 new file mode 100644 index 00000000..56cc5ea2 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java @@ -0,0 +1,101 @@ +/* +* Copyright 2008 Federal Chancellery Austria and +* Graz University of Technology +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package at.gv.egiz.bku.online.applet; + +import java.util.Locale; +import java.util.ResourceBundle; + +import javax.net.ssl.HttpsURLConnection; +import javax.swing.JApplet; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.bku.gui.BKUGUIFactory; + +/** + * + * + * + */ +public class BKUApplet extends JApplet { + + private static Log log = LogFactory.getLog(BKUApplet.class); + + 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"; + public final static String SESSION_ID="SessionID"; + + protected ResourceBundle resourceBundle; + protected BKUWorker worker; + protected Thread workerThread; + + public BKUApplet() { + } + + public void init() { + log.debug("Called init()"); + try { + HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getSocketFactory()); + HttpsURLConnection.setDefaultHostnameVerifier(InternalSSLSocketFactory.getHostNameVerifier()); + } catch (InternalSSLSocketFactoryException e) { + log.error(e); + } + String localeString = getMyAppletParameter(LOCALE_PARAM_KEY); + if (localeString != null) { + resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE, + new Locale(localeString)); + } else { + resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE); + } + BKUGUIFacade gui = BKUGUIFactory.createGUI(); + gui.init(getContentPane(), localeString); + worker = new BKUWorker(gui, this, resourceBundle); + } + + public void start() { + log.debug("Called start()"); + workerThread = new Thread(worker); + workerThread.start(); + } + + public void stop() { + log.debug("Called stop()"); + if ((workerThread != null) && (workerThread.isAlive())) { + workerThread.interrupt(); + } + } + + public void destroy() { + log.debug("Called destroy()"); + } + + /** + * Applet configuration parameters + * + * @param paramKey + * @return + */ + public String getMyAppletParameter(String paramKey) { + log.info("Getting parameter: "+paramKey+ ": "+ getParameter(paramKey)); + return getParameter(paramKey); + } +} 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 new file mode 100644 index 00000000..38fd6428 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java @@ -0,0 +1,286 @@ +/* +* Copyright 2008 Federal Chancellery Austria and +* Graz University of Technology +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package at.gv.egiz.bku.online.applet; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.ResourceBundle; + +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; +import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; +import at.gv.egiz.smcc.SignatureCard; +import at.gv.egiz.smcc.util.SMCCHelper; +import at.gv.egiz.stal.QuitRequest; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.service.GetNextRequestResponseType; +import at.gv.egiz.stal.service.GetNextRequestType; +import at.gv.egiz.stal.service.ObjectFactory; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.STALService; + +public class BKUWorker extends AbstractSMCCSTAL implements Runnable, + ActionListener, SMCCSTALRequestHandler { + + private static Log log = LogFactory.getLog(BKUWorker.class); + + protected BKUGUIFacade gui; + protected BKUApplet parent; + private STALPortType stalPort; + 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)) { + throw new NullPointerException("Parameter must not be set to null"); + } + this.gui = gui; + this.parent = parent; + this.errorMessages = errorMessageBundle; + addRequestHandler(QuitRequest.class, this); + } + + private STALPortType getSTALPort() throws MalformedURLException { + URL wsdlURL = null; + String wsdlLocation = parent.getMyAppletParameter(BKUApplet.WSDL_URL); + URL codebase = parent.getCodeBase(); + log.debug("Connecting to webservice: " + wsdlLocation); + if (wsdlLocation != null) { + try { + if (codebase.getProtocol().equalsIgnoreCase("file")) { + // for debugging in appletrunner + wsdlURL = new URL(wsdlLocation); + } else { + wsdlURL = new URL(codebase, wsdlLocation); + } + } catch (MalformedURLException ex) { + log.fatal("Paremeter 'wsdlLocation' is not a vailid URL.", ex); + throw new MalformedURLException(ex.getMessage()); + } + } else { + log.fatal("Paremeter 'wsdlLocation' is not set."); + throw new MalformedURLException("Null WSDL url"); + } + log.debug("Found WSDL url: " + wsdlURL); + QName endpointName = new QName("http://www.egiz.gv.at/wsdl/stal", + "STALService"); + STALService stal = new STALService(wsdlURL, endpointName); + return stal.getSTALPort(); + } + + @Override + public void run() { + gui.showWelcomeDialog(); + try { + stalPort = getSTALPort(); + } catch (Exception e) { + log.fatal("Failed to call STAL service.", e); + actionCommandList.clear(); + actionCommandList.add("ok"); + gui.showErrorDialog(errorMessages.getString("failed.WS")); + try { + waitForAction(); + } catch (InterruptedException e1) { + log.error(e1); + } + return; + } + + ObjectFactory factory = new ObjectFactory(); + GetNextRequestType nextRequest = factory.createGetNextRequestType(); + + String sessionId = parent.getMyAppletParameter(BKUApplet.SESSION_ID); + if (sessionId == null) { + // use the testsession for testing + sessionId = "TestSession"; + } + nextRequest.setSessionId(sessionId); + do { + GetNextRequestResponseType resp = stalPort.getNextRequest(nextRequest); + log.info("Got " + resp.getRequest().size() + " requests from server."); + List stalRequests = resp.getRequest(); + List responses = handleRequest(stalRequests); + log.info("Got " + responses.size() + " responses."); + nextRequest = factory.createGetNextRequestType(); + nextRequest.setSessionId(sessionId); + nextRequest.getResponse().addAll(responses); + } while (!finished); + log.info("Done " + Thread.currentThread().getName()); + gui.showWelcomeDialog(); + sendRedirect(); + } + + protected void sendRedirect() { + log.info("Done, sending redirect to get BKU response"); + String redirectURL = parent.getMyAppletParameter("redirectURL"); + String redirectTarget = parent.getMyAppletParameter("redirectTarget"); + log.info("Redirecting to: " + redirectURL + " target: " + redirectTarget); + URL url = null; + if (redirectURL != null) { + try { + url = new URL(parent.getCodeBase(),redirectURL + ";jsessionid=" + + parent.getMyAppletParameter(BKUApplet.SESSION_ID)); + } catch (MalformedURLException ex) { + log.warn("Parameter 'redirectURL': " + redirectURL + + " not a valid URL.", ex); + // gui.showErrorDialog(errorMsg, okListener, actionCommand) + } + if (url != null) { + if (redirectTarget == null) { + log.info("Done. Trying to redirect to " + url + " ..."); + parent.getAppletContext().showDocument(url); + } else { + log.info("Done. Trying to redirect to " + url + " (target=" + + redirectTarget + ") ..."); + parent.getAppletContext().showDocument(url, redirectTarget); + } + } + } else { + log.error("No redirect URL set"); + } + } + + protected synchronized void waitForAction() throws InterruptedException { + log.info("Waiting for Action"); + while (!actionPerformed) { + wait(); + } + actionPerformed = false; + } + + protected synchronized void actionOccured() { + log.info("Received Action"); + actionPerformed = true; + notifyAll(); + } + + @Override + public void actionPerformed(ActionEvent e) { + log.info("Action: " + e); + if (actionCommandList != null) { + if (actionCommandList.contains(e.getActionCommand())) { + actionOccured(); + } + } else { + actionOccured(); + } + } + + @Override + protected boolean waitForCard() { + SMCCHelper smccHelper = new SMCCHelper(); + actionCommandList.clear(); + actionCommandList.add("cancel"); + // while no sigcard found or cancel button pressed + int oldValue = SMCCHelper.PC_SC_NOT_SUPPORTED; // this is a save default + while ((signatureCard == null) && (!actionPerformed)) { + switch (smccHelper.getResultCode()) { + case SMCCHelper.PC_SC_NOT_SUPPORTED: + actionCommandList.clear(); + actionCommandList.add("ok"); + gui.showErrorDialog(errorMessages.getString("nopcscsupport"), this, + "ok"); + try { + waitForAction(); + } catch (InterruptedException e) { + log.error(e); + } + return true; + case SMCCHelper.TERMINAL_NOT_PRESENT: + actionCommandList.clear(); + actionCommandList.add("ok"); + gui.showErrorDialog(errorMessages.getString("nocardterminal"), this, + "ok"); + try { + waitForAction(); + } catch (InterruptedException e) { + log.error(e); + } + return true; + case SMCCHelper.CARD_NOT_SUPPORTED: + if (oldValue != SMCCHelper.CARD_NOT_SUPPORTED) { + actionCommandList.clear(); + actionCommandList.add("cancel"); + gui.showCardNotSupportedDialog(this, "cancel"); + oldValue = SMCCHelper.CARD_NOT_SUPPORTED; + } + break; + case SMCCHelper.NO_CARD: + if (oldValue != SMCCHelper.NO_CARD) { + actionCommandList.clear(); + actionCommandList.add("cancel"); + gui.showInsertCardDialog(this, "cancel"); + oldValue = SMCCHelper.NO_CARD; + } + break; + case SMCCHelper.CARD_FOUND: + gui.showWelcomeDialog(); + signatureCard = smccHelper.getSignatureCard(errorMessages.getLocale()); + return false; + } + smccHelper.update(3000); + } + return signatureCard == null; + } + + @Override + public STALResponse handleRequest(STALRequest request) { + if (request instanceof QuitRequest) { + finished = true; + } else { + log.error("Unexpected request to handle: " + request); + } + return null; + } + + @Override + public void init(SignatureCard sc, BKUGUIFacade gui) { + } + + @Override + public SMCCSTALRequestHandler newInstance() { + return this; + } + + @Override + public boolean requireCard() { + return false; + } + + @Override + protected BKUGUIFacade getGUI() { + return gui; + } +} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java new file mode 100644 index 00000000..ab04d2b6 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java @@ -0,0 +1,101 @@ +/* +* Copyright 2008 Federal Chancellery Austria and +* Graz University of Technology +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.bku.online.applet; + +import java.io.IOException; +import java.security.KeyManagementException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; +import javax.net.ssl.SSLSocketFactory; +import javax.net.ssl.X509TrustManager; + +public class InternalSSLSocketFactory { + + private SSLSocketFactory factory; + + public static SSLSocketFactory getSocketFactory() throws InternalSSLSocketFactoryException { + return new InternalSSLSocketFactory().factory; + } + + public static HostnameVerifier getHostNameVerifier() throws InternalSSLSocketFactoryException { + return (new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }); + } + + public InternalSSLSocketFactory() throws InternalSSLSocketFactoryException { + SSLContext sslContext; + try { + sslContext = SSLContext.getInstance("TLSv1"); + sslContext.getClientSessionContext().setSessionTimeout(0); + KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); + + KeyStore keyStore = KeyStore.getInstance("JKS"); + keyStore.load(null, null); + keyManagerFactory.init(keyStore, null); + + sslContext.init(keyManagerFactory.getKeyManagers(), + new X509TrustManager[] { new AcceptAllTrustManager() }, + null); + } catch (NoSuchAlgorithmException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (CertificateException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (IOException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (KeyStoreException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (UnrecoverableKeyException e) { + throw new InternalSSLSocketFactoryException(e); + } catch (KeyManagementException e) { + throw new InternalSSLSocketFactoryException(e); + } + + this.factory = sslContext.getSocketFactory(); + } + + class AcceptAllTrustManager implements X509TrustManager { + + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + public void checkClientTrusted(X509Certificate[] chain, String authType) { + } + + public void checkServerTrusted(X509Certificate[] chain, String authType) { + //FIXME + } + } +}; diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java new file mode 100644 index 00000000..c620284a --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java @@ -0,0 +1,45 @@ +/* +* Copyright 2008 Federal Chancellery Austria and +* Graz University of Technology +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.bku.online.applet; + +/** + * + * @author mcentner + */ +public class InternalSSLSocketFactoryException extends Exception { + + public InternalSSLSocketFactoryException(Throwable cause) { + super(cause); + } + + public InternalSSLSocketFactoryException(String message, Throwable cause) { + super(message, cause); + } + + public InternalSSLSocketFactoryException(String message) { + super(message); + } + + public InternalSSLSocketFactoryException() { + } + +} diff --git a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties new file mode 100644 index 00000000..752004e8 --- /dev/null +++ b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties @@ -0,0 +1,58 @@ +# Copyright 2008 Federal Chancellery Austria and +# Graz University of Technology +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# -------- BEGIN bootstrap applet -----------# +java16required=This Applet requires Java 1.6 or higher to run. \ + Please download and install a recent version of Java. \ +

For Windows, Linux and Solaris plattforms you can download Java from \ + http://java.sun.com/javase/downloads.\ +

+ +failedtostart=Failed to start Applet. \ +

{0}

+# -------- END bootstrap applet -----------# + + +applet.name=Online Citicen Card Environment (CCE) + +nopcscsupport=The Java plattform does not seem to provide \ +a PC/SC interface to acces a smartcard. + +nocardterminal=Can not find a connected smartcard reader.\ +

Either there is no smartcard reader connected, or \ + no PC/SC driver is installed for a connected smartcard reader.

+ +insertcard=Please insert your citicen card (B\u00FCrgerkarte) into your \ + smartcard reader. + +unsupportedcard=The inserted smartcard is not supported.\ +

Please insert your citicen card (B\u00FCrgerkarte) \ + into your smartcard reader.

+ +enterpin=Please enter {0} \(min {1}, max {2} digits\). + +enterpinretries=Please enter {0} \(min {1}, max {2} digits, {3} retries left\). + +pinwrong=Entered PIN is wrong. + +button.ok=Ok + +button.cancel=Cancel + +status.findpcsc=Looking for PC/SC support + +status.findsupportedcard=Looking for a supported smartcard + +failed.WS=Webservice cannot be reached. \ No newline at end of file diff --git a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties new file mode 100644 index 00000000..e6b815e9 --- /dev/null +++ b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties @@ -0,0 +1,42 @@ +# Copyright 2008 Federal Chancellery Austria and +# Graz University of Technology +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# -------- BEGIN bootstrap applet -----------# +java16required=Dieses Applet ben\u00F6tigt Java Version 1.6 oder h\u00F6her. \ + Bitte installieren sie eine aktulle Version von Java. \ +

F\u00FCr Windows, Linux and Solaris kann Java von \ + http://java.sun.com/javase/downloads \ + heruntergeladen werden.

+ +failedtostart=Das Applet konnte nicht gestartet werden. \ +

{0}

+# -------- END bootstrap applet -----------# + +applet.name=Online B\u00FCrgerkartenumgebung (BKU) + +nopcscsupport=Die Java-Installation stellt keine \ + PC/SC-Schnittstelle zum Zugriff auf eine Chipkarte zur Verf\u00FCgung. + +nocardterminal=Es konnte kein Chipkartenleser gefunden werden.\ +

Entweder, es ist kein Chipkartenleser angeschlossen, oder \ + f\u00FCr den angeschlossenen Chipkartenleser ist kein PC/SC-Treiber \ + installiert.

+ +insertcard=Bitte stecken Sie ihre B\u00FCrgerkarte in den Chipkartenleser. + +unsupportedcard=Die gesteckte Chipkarte wird nicht unterst\u00FCtzt.\ +

Bitte stecken Sie ihre B\u00FCrgerkare in den Chipkartenleser

+ +failed.WS=Das Webservice kann nicht erreicht werden. \ No newline at end of file diff --git a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png new file mode 100644 index 00000000..eee4be4f Binary files /dev/null and b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png differ diff --git a/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java b/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java new file mode 100644 index 00000000..9b58798d --- /dev/null +++ b/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java @@ -0,0 +1,96 @@ +/* +* Copyright 2008 Federal Chancellery Austria and +* Graz University of Technology +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.stal.client; + +import static org.junit.Assert.assertNotNull; + +import java.net.MalformedURLException; +import java.net.URL; + +import javax.xml.namespace.QName; + +import org.junit.Test; + +import at.gv.egiz.stal.InfoboxReadRequest; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.service.GetHashDataInputFault; +import at.gv.egiz.stal.service.GetHashDataInputResponseType; +import at.gv.egiz.stal.service.GetHashDataInputType; +import at.gv.egiz.stal.service.GetNextRequestResponseType; +import at.gv.egiz.stal.service.GetNextRequestType; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.STALService; + +/** + * + * @author clemens + */ +public class STALServiceTest { + +// @Test + public void callSTAL() { + try { + URL endpointURL = new URL("http://localhost:8080/bkuonline/stal?wsdl"); + QName endpointName = new QName("http://www.egiz.gv.at/wsdl/stal", "STALService"); + STALService stal = new STALService(endpointURL, endpointName); +// stal = new STALService(); + STALPortType port = stal.getSTALPort(); + + GetNextRequestType nrReq = new GetNextRequestType(); + nrReq.setSessionId("TestSession"); //STALServiceImpl.TEST_SESSION_ID); +// req.getResponse().add(new ErrorResponse(1234)); + GetNextRequestResponseType nrResp = port.getNextRequest(nrReq); + assertNotNull(nrResp); + System.out.println("got response: " + nrResp.getRequest().size()); + for (STALRequest stalReq : nrResp.getRequest()) { + if (stalReq instanceof InfoboxReadRequest) { + String ibid = ((InfoboxReadRequest) stalReq).getInfoboxIdentifier(); + String did = ((InfoboxReadRequest) stalReq).getDomainIdentifier(); + System.out.println(" received InfoboxReadRequest for " + ibid + ", " + did); + } else { + System.out.println(" received STAL request " + stalReq.getClass().getName()); + } + } + + GetHashDataInputType hdReq = new GetHashDataInputType(); + hdReq.setSessionId("TestSession"); //STALServiceImpl.TEST_SESSION_ID); + GetHashDataInputType.Reference ref = new GetHashDataInputType.Reference(); + ref.setID("refId"); + hdReq.getReference().add(ref); + GetHashDataInputResponseType hdResp = port.getHashDataInput(hdReq); + GetHashDataInputResponseType.Reference hdRef = hdResp.getReference().get(0); + System.out.println("got HashDataInput " + new String(hdRef.getValue())); + + + } catch (GetHashDataInputFault ex) { + ex.printStackTrace(); + } catch (MalformedURLException ex) { + ex.printStackTrace(); + } + } + + @Test + public void testSTAL() { + //TODO + } + +} -- cgit v1.2.3 From 63f2a4f1f098cc39bd092fef77a94d73056f51f6 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 5 Sep 2008 13:38:24 +0000 Subject: HashDataInput git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@19 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 4 +- .../at/gv/egiz/bku/online/applet/BKUWorker.java | 543 +++++++++++---------- .../bku/online/applet/WSSignRequestHandler.java | 90 ++++ .../src/main/resources/commons-logging.properties | 16 + BKUApplet/src/main/resources/simplelog.properties | 25 + 5 files changed, 405 insertions(+), 273 deletions(-) create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java create mode 100644 BKUApplet/src/main/resources/commons-logging.properties create mode 100644 BKUApplet/src/main/resources/simplelog.properties (limited to 'BKUApplet') 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 56cc5ea2..5d4d0dab 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 @@ -29,9 +29,7 @@ import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIFactory; /** - * - * - * + * Note: all swing code is executed by the event dispatch thread (see BKUGUIFacade) */ public class BKUApplet extends JApplet { 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 38fd6428..f7b5fb2f 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 @@ -14,273 +14,276 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.online.applet; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.ResourceBundle; - -import javax.xml.namespace.QName; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.bku.gui.BKUGUIFacade; -import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; -import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; -import at.gv.egiz.smcc.SignatureCard; -import at.gv.egiz.smcc.util.SMCCHelper; -import at.gv.egiz.stal.QuitRequest; -import at.gv.egiz.stal.STALRequest; -import at.gv.egiz.stal.STALResponse; -import at.gv.egiz.stal.service.GetNextRequestResponseType; -import at.gv.egiz.stal.service.GetNextRequestType; -import at.gv.egiz.stal.service.ObjectFactory; -import at.gv.egiz.stal.service.STALPortType; -import at.gv.egiz.stal.service.STALService; - -public class BKUWorker extends AbstractSMCCSTAL implements Runnable, - ActionListener, SMCCSTALRequestHandler { - - private static Log log = LogFactory.getLog(BKUWorker.class); - - protected BKUGUIFacade gui; - protected BKUApplet parent; - private STALPortType stalPort; - 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)) { - throw new NullPointerException("Parameter must not be set to null"); - } - this.gui = gui; - this.parent = parent; - this.errorMessages = errorMessageBundle; - addRequestHandler(QuitRequest.class, this); - } - - private STALPortType getSTALPort() throws MalformedURLException { - URL wsdlURL = null; - String wsdlLocation = parent.getMyAppletParameter(BKUApplet.WSDL_URL); - URL codebase = parent.getCodeBase(); - log.debug("Connecting to webservice: " + wsdlLocation); - if (wsdlLocation != null) { - try { - if (codebase.getProtocol().equalsIgnoreCase("file")) { - // for debugging in appletrunner - wsdlURL = new URL(wsdlLocation); - } else { - wsdlURL = new URL(codebase, wsdlLocation); - } - } catch (MalformedURLException ex) { - log.fatal("Paremeter 'wsdlLocation' is not a vailid URL.", ex); - throw new MalformedURLException(ex.getMessage()); - } - } else { - log.fatal("Paremeter 'wsdlLocation' is not set."); - throw new MalformedURLException("Null WSDL url"); - } - log.debug("Found WSDL url: " + wsdlURL); - QName endpointName = new QName("http://www.egiz.gv.at/wsdl/stal", - "STALService"); - STALService stal = new STALService(wsdlURL, endpointName); - return stal.getSTALPort(); - } - - @Override - public void run() { - gui.showWelcomeDialog(); - try { - stalPort = getSTALPort(); - } catch (Exception e) { - log.fatal("Failed to call STAL service.", e); - actionCommandList.clear(); - actionCommandList.add("ok"); - gui.showErrorDialog(errorMessages.getString("failed.WS")); - try { - waitForAction(); - } catch (InterruptedException e1) { - log.error(e1); - } - return; - } - - ObjectFactory factory = new ObjectFactory(); - GetNextRequestType nextRequest = factory.createGetNextRequestType(); - - String sessionId = parent.getMyAppletParameter(BKUApplet.SESSION_ID); - if (sessionId == null) { - // use the testsession for testing - sessionId = "TestSession"; - } - nextRequest.setSessionId(sessionId); - do { - GetNextRequestResponseType resp = stalPort.getNextRequest(nextRequest); - log.info("Got " + resp.getRequest().size() + " requests from server."); - List stalRequests = resp.getRequest(); - List responses = handleRequest(stalRequests); - log.info("Got " + responses.size() + " responses."); - nextRequest = factory.createGetNextRequestType(); - nextRequest.setSessionId(sessionId); - nextRequest.getResponse().addAll(responses); - } while (!finished); - log.info("Done " + Thread.currentThread().getName()); - gui.showWelcomeDialog(); - sendRedirect(); - } - - protected void sendRedirect() { - log.info("Done, sending redirect to get BKU response"); - String redirectURL = parent.getMyAppletParameter("redirectURL"); - String redirectTarget = parent.getMyAppletParameter("redirectTarget"); - log.info("Redirecting to: " + redirectURL + " target: " + redirectTarget); - URL url = null; - if (redirectURL != null) { - try { - url = new URL(parent.getCodeBase(),redirectURL + ";jsessionid=" - + parent.getMyAppletParameter(BKUApplet.SESSION_ID)); - } catch (MalformedURLException ex) { - log.warn("Parameter 'redirectURL': " + redirectURL - + " not a valid URL.", ex); - // gui.showErrorDialog(errorMsg, okListener, actionCommand) - } - if (url != null) { - if (redirectTarget == null) { - log.info("Done. Trying to redirect to " + url + " ..."); - parent.getAppletContext().showDocument(url); - } else { - log.info("Done. Trying to redirect to " + url + " (target=" - + redirectTarget + ") ..."); - parent.getAppletContext().showDocument(url, redirectTarget); - } - } - } else { - log.error("No redirect URL set"); - } - } - - protected synchronized void waitForAction() throws InterruptedException { - log.info("Waiting for Action"); - while (!actionPerformed) { - wait(); - } - actionPerformed = false; - } - - protected synchronized void actionOccured() { - log.info("Received Action"); - actionPerformed = true; - notifyAll(); - } - - @Override - public void actionPerformed(ActionEvent e) { - log.info("Action: " + e); - if (actionCommandList != null) { - if (actionCommandList.contains(e.getActionCommand())) { - actionOccured(); - } - } else { - actionOccured(); - } - } - - @Override - protected boolean waitForCard() { - SMCCHelper smccHelper = new SMCCHelper(); - actionCommandList.clear(); - actionCommandList.add("cancel"); - // while no sigcard found or cancel button pressed - int oldValue = SMCCHelper.PC_SC_NOT_SUPPORTED; // this is a save default - while ((signatureCard == null) && (!actionPerformed)) { - switch (smccHelper.getResultCode()) { - case SMCCHelper.PC_SC_NOT_SUPPORTED: - actionCommandList.clear(); - actionCommandList.add("ok"); - gui.showErrorDialog(errorMessages.getString("nopcscsupport"), this, - "ok"); - try { - waitForAction(); - } catch (InterruptedException e) { - log.error(e); - } - return true; - case SMCCHelper.TERMINAL_NOT_PRESENT: - actionCommandList.clear(); - actionCommandList.add("ok"); - gui.showErrorDialog(errorMessages.getString("nocardterminal"), this, - "ok"); - try { - waitForAction(); - } catch (InterruptedException e) { - log.error(e); - } - return true; - case SMCCHelper.CARD_NOT_SUPPORTED: - if (oldValue != SMCCHelper.CARD_NOT_SUPPORTED) { - actionCommandList.clear(); - actionCommandList.add("cancel"); - gui.showCardNotSupportedDialog(this, "cancel"); - oldValue = SMCCHelper.CARD_NOT_SUPPORTED; - } - break; - case SMCCHelper.NO_CARD: - if (oldValue != SMCCHelper.NO_CARD) { - actionCommandList.clear(); - actionCommandList.add("cancel"); - gui.showInsertCardDialog(this, "cancel"); - oldValue = SMCCHelper.NO_CARD; - } - break; - case SMCCHelper.CARD_FOUND: - gui.showWelcomeDialog(); - signatureCard = smccHelper.getSignatureCard(errorMessages.getLocale()); - return false; - } - smccHelper.update(3000); - } - return signatureCard == null; - } - - @Override - public STALResponse handleRequest(STALRequest request) { - if (request instanceof QuitRequest) { - finished = true; - } else { - log.error("Unexpected request to handle: " + request); - } - return null; - } - - @Override - public void init(SignatureCard sc, BKUGUIFacade gui) { - } - - @Override - public SMCCSTALRequestHandler newInstance() { - return this; - } - - @Override - public boolean requireCard() { - return false; - } - - @Override - protected BKUGUIFacade getGUI() { - return gui; - } -} +package at.gv.egiz.bku.online.applet; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.ResourceBundle; + +import javax.xml.namespace.QName; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; +import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; +import at.gv.egiz.smcc.SignatureCard; +import at.gv.egiz.smcc.util.SMCCHelper; +import at.gv.egiz.stal.QuitRequest; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.SignRequest; +import at.gv.egiz.stal.service.GetNextRequestResponseType; +import at.gv.egiz.stal.service.GetNextRequestType; +import at.gv.egiz.stal.service.ObjectFactory; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.STALService; + +public class BKUWorker extends AbstractSMCCSTAL implements Runnable, + ActionListener, SMCCSTALRequestHandler { + + private static Log log = LogFactory.getLog(BKUWorker.class); + + protected BKUGUIFacade gui; + protected BKUApplet parent; + private STALPortType stalPort; + 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)) { + throw new NullPointerException("Parameter must not be set to null"); + } + this.gui = gui; + this.parent = parent; + this.errorMessages = errorMessageBundle; + addRequestHandler(QuitRequest.class, this); + //register SignRequestHandler once we have a webservice port + } + + private STALPortType getSTALPort() throws MalformedURLException { + URL wsdlURL = null; + String wsdlLocation = parent.getMyAppletParameter(BKUApplet.WSDL_URL); + URL codebase = parent.getCodeBase(); + log.debug("Connecting to webservice: " + wsdlLocation); + if (wsdlLocation != null) { + try { + if (codebase.getProtocol().equalsIgnoreCase("file")) { + // for debugging in appletrunner + wsdlURL = new URL(wsdlLocation); + } else { + wsdlURL = new URL(codebase, wsdlLocation); + } + } catch (MalformedURLException ex) { + log.fatal("Paremeter 'wsdlLocation' is not a vailid URL.", ex); + throw new MalformedURLException(ex.getMessage()); + } + } else { + log.fatal("Paremeter 'wsdlLocation' is not set."); + throw new MalformedURLException("Null WSDL url"); + } + log.debug("Found WSDL url: " + wsdlURL); + QName endpointName = new QName("http://www.egiz.gv.at/wsdl/stal", + "STALService"); + STALService stal = new STALService(wsdlURL, endpointName); + return stal.getSTALPort(); + } + + @Override + public void run() { + gui.showWelcomeDialog(); + try { + stalPort = getSTALPort(); + } catch (Exception e) { + log.fatal("Failed to call STAL service.", e); + actionCommandList.clear(); + actionCommandList.add("ok"); + gui.showErrorDialog(errorMessages.getString("failed.WS")); + try { + waitForAction(); + } catch (InterruptedException e1) { + log.error(e1); + } + return; + } + + ObjectFactory factory = new ObjectFactory(); + GetNextRequestType nextRequest = factory.createGetNextRequestType(); + + String sessionId = parent.getMyAppletParameter(BKUApplet.SESSION_ID); + if (sessionId == null) { + // use the testsession for testing + sessionId = "TestSession"; + } + nextRequest.setSessionId(sessionId); + addRequestHandler(SignRequest.class, new WSSignRequestHandler(sessionId, stalPort)); + do { + GetNextRequestResponseType resp = stalPort.getNextRequest(nextRequest); + log.info("Got " + resp.getRequest().size() + " requests from server."); + List stalRequests = resp.getRequest(); + List responses = handleRequest(stalRequests); + log.info("Got " + responses.size() + " responses."); + nextRequest = factory.createGetNextRequestType(); + nextRequest.setSessionId(sessionId); + nextRequest.getResponse().addAll(responses); + } while (!finished); + log.info("Done " + Thread.currentThread().getName()); + gui.showWelcomeDialog(); + sendRedirect(); + } + + protected void sendRedirect() { + log.info("Done, sending redirect to get BKU response"); + String redirectURL = parent.getMyAppletParameter("redirectURL"); + String redirectTarget = parent.getMyAppletParameter("redirectTarget"); + log.info("Redirecting to: " + redirectURL + " target: " + redirectTarget); + URL url = null; + if (redirectURL != null) { + try { + url = new URL(parent.getCodeBase(),redirectURL + ";jsessionid=" + + parent.getMyAppletParameter(BKUApplet.SESSION_ID)); + } catch (MalformedURLException ex) { + log.warn("Parameter 'redirectURL': " + redirectURL + + " not a valid URL.", ex); + // gui.showErrorDialog(errorMsg, okListener, actionCommand) + } + if (url != null) { + if (redirectTarget == null) { + log.info("Done. Trying to redirect to " + url + " ..."); + parent.getAppletContext().showDocument(url); + } else { + log.info("Done. Trying to redirect to " + url + " (target=" + + redirectTarget + ") ..."); + parent.getAppletContext().showDocument(url, redirectTarget); + } + } + } else { + log.error("No redirect URL set"); + } + } + + protected synchronized void waitForAction() throws InterruptedException { + log.info("Waiting for Action"); + while (!actionPerformed) { + wait(); + } + actionPerformed = false; + } + + protected synchronized void actionOccured() { + log.info("Received Action"); + actionPerformed = true; + notifyAll(); + } + + @Override + public void actionPerformed(ActionEvent e) { + log.info("Action: " + e); + if (actionCommandList != null) { + if (actionCommandList.contains(e.getActionCommand())) { + actionOccured(); + } + } else { + actionOccured(); + } + } + + @Override + protected boolean waitForCard() { + SMCCHelper smccHelper = new SMCCHelper(); + actionCommandList.clear(); + actionCommandList.add("cancel"); + // while no sigcard found or cancel button pressed + int oldValue = SMCCHelper.PC_SC_NOT_SUPPORTED; // this is a save default + while ((signatureCard == null) && (!actionPerformed)) { + switch (smccHelper.getResultCode()) { + case SMCCHelper.PC_SC_NOT_SUPPORTED: + actionCommandList.clear(); + actionCommandList.add("ok"); + gui.showErrorDialog(errorMessages.getString("nopcscsupport"), this, + "ok"); + try { + waitForAction(); + } catch (InterruptedException e) { + log.error(e); + } + return true; + case SMCCHelper.TERMINAL_NOT_PRESENT: + actionCommandList.clear(); + actionCommandList.add("ok"); + gui.showErrorDialog(errorMessages.getString("nocardterminal"), this, + "ok"); + try { + waitForAction(); + } catch (InterruptedException e) { + log.error(e); + } + return true; + case SMCCHelper.CARD_NOT_SUPPORTED: + if (oldValue != SMCCHelper.CARD_NOT_SUPPORTED) { + actionCommandList.clear(); + actionCommandList.add("cancel"); + gui.showCardNotSupportedDialog(this, "cancel"); + oldValue = SMCCHelper.CARD_NOT_SUPPORTED; + } + break; + case SMCCHelper.NO_CARD: + if (oldValue != SMCCHelper.NO_CARD) { + actionCommandList.clear(); + actionCommandList.add("cancel"); + gui.showInsertCardDialog(this, "cancel"); + oldValue = SMCCHelper.NO_CARD; + } + break; + case SMCCHelper.CARD_FOUND: + gui.showWelcomeDialog(); + signatureCard = smccHelper.getSignatureCard(errorMessages.getLocale()); + return false; + } + smccHelper.update(3000); + } + return signatureCard == null; + } + + @Override + public STALResponse handleRequest(STALRequest request) { + if (request instanceof QuitRequest) { + finished = true; + } else { + log.error("Unexpected request to handle: " + request); + } + return null; + } + + @Override + public void init(SignatureCard sc, BKUGUIFacade gui) { + } + + @Override + public SMCCSTALRequestHandler newInstance() { + return this; + } + + @Override + public boolean requireCard() { + return false; + } + + @Override + protected BKUGUIFacade getGUI() { + return gui; + } +} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java new file mode 100644 index 00000000..f9965240 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java @@ -0,0 +1,90 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.online.applet; + +import at.gv.egiz.stal.HashDataInput; +import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; +import at.gv.egiz.bku.smccstal.SignRequestHandler; +import at.gv.egiz.stal.impl.ByteArrayHashDataInput; +import at.gv.egiz.stal.service.GetHashDataInputResponseType; +import at.gv.egiz.stal.service.GetHashDataInputType; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.signedinfo.ReferenceType; +import java.util.ArrayList; +import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author clemens + */ +public class WSSignRequestHandler extends SignRequestHandler { + + private static final Log log = LogFactory.getLog(WSSignRequestHandler.class); + STALPortType stalPort; + String sessId; + + public WSSignRequestHandler(String sessId, STALPortType stalPort) { + if (stalPort == null || sessId == null) { + throw new NullPointerException("STAL port must not be null"); + } + this.sessId = sessId; + this.stalPort = stalPort; + } + + @Override + protected List getHashDataInputs(List dsigReferences) throws Exception { + GetHashDataInputType request = new GetHashDataInputType(); + request.setSessionId(sessId); + for (ReferenceType dsigRef : dsigReferences) { + //don't get Manifest, QualifyingProperties, ... + if (dsigRef.getType() == null) { + String dsigRefId = dsigRef.getId(); + if (dsigRefId != null) { + GetHashDataInputType.Reference reference = new GetHashDataInputType.Reference(); + reference.setID(dsigRefId); + request.getReference().add(reference); + } else { + throw new Exception("Cannot get HashDataInput for dsig:Reference without Id attribute"); + } + } + } + + if (log.isDebugEnabled()) { + log.debug("Calling GetHashDataInput for session " + sessId); + } + GetHashDataInputResponseType response = stalPort.getHashDataInput(request); + ArrayList hashDataInputs = new ArrayList(); + for (GetHashDataInputResponseType.Reference reference : response.getReference()) { + byte[] hdi = reference.getValue(); + String id = reference.getID(); + String mimeType = reference.getMimeType(); + + if (log.isDebugEnabled()) { + log.debug("Got HashDataInput " + id + " (" + mimeType + ")"); + } + hashDataInputs.add(new ByteArrayHashDataInput(hdi, id, mimeType)); + } + return hashDataInputs; + } + + @Override + public SMCCSTALRequestHandler newInstance() { + return new WSSignRequestHandler(this.sessId, this.stalPort); + } +} diff --git a/BKUApplet/src/main/resources/commons-logging.properties b/BKUApplet/src/main/resources/commons-logging.properties new file mode 100644 index 00000000..faa21c47 --- /dev/null +++ b/BKUApplet/src/main/resources/commons-logging.properties @@ -0,0 +1,16 @@ +# Copyright 2008 Federal Chancellery Austria and +# Graz University of Technology +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +org.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog \ No newline at end of file diff --git a/BKUApplet/src/main/resources/simplelog.properties b/BKUApplet/src/main/resources/simplelog.properties new file mode 100644 index 00000000..d62508cf --- /dev/null +++ b/BKUApplet/src/main/resources/simplelog.properties @@ -0,0 +1,25 @@ +# Copyright 2008 Federal Chancellery Austria and +# Graz University of Technology +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Logging detail level, +# Must be one of ("trace", "debug", "info", "warn", "error", or "fatal"). +org.apache.commons.logging.simplelog.defaultlog=debug +# Logs the Log instance used +org.apache.commons.logging.simplelog.showlogname=true +#Logs the class name with package(or Path) +#( Valid Values "true","false". Default Value "true") +org.apache.commons.logging.simplelog.showShortLogname=true +#Logs date and time( Valid Values "true","false". Default Value "false") +org.apache.commons.logging.simplelog.showdatetime=false -- cgit v1.2.3 From c7cbf8a12db4fcb77fd374392e88c3fa04b1e100 Mon Sep 17 00:00:00 2001 From: wbauer Date: Tue, 9 Sep 2008 09:54:32 +0000 Subject: added check to avoid sending baseid to non .gv.at domains git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@25 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 139 ++++++------ .../at/gv/egiz/bku/online/applet/BKUWorker.java | 25 ++- .../online/applet/InternalSSLSocketFactory.java | 237 +++++++++++++-------- .../applet/InternalSSLSocketFactoryException.java | 45 ---- 4 files changed, 240 insertions(+), 206 deletions(-) delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java (limited to 'BKUApplet') 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 5d4d0dab..8289f30b 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 @@ -1,19 +1,19 @@ /* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package at.gv.egiz.bku.online.applet; import java.util.Locale; @@ -29,71 +29,68 @@ import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIFactory; /** - * Note: all swing code is executed by the event dispatch thread (see BKUGUIFacade) + * Note: all swing code is executed by the event dispatch thread (see + * BKUGUIFacade) */ public class BKUApplet extends JApplet { - private static Log log = LogFactory.getLog(BKUApplet.class); + private static Log log = LogFactory.getLog(BKUApplet.class); + + public final static String RESOURCE_BUNDLE_BASE = "at/gv/egiz/bku/online/applet/Messages"; - 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"; + public final static String SESSION_ID = "SessionID"; - public final static String LOCALE_PARAM_KEY = "Locale"; - public final static String LOGO_URL_KEY="LogoURL"; - public final static String WSDL_URL="WSDL_URL"; - public final static String SESSION_ID="SessionID"; + protected ResourceBundle resourceBundle; + protected BKUWorker worker; + protected Thread workerThread; - protected ResourceBundle resourceBundle; - protected BKUWorker worker; - protected Thread workerThread; - - public BKUApplet() { - } + public BKUApplet() { + } - public void init() { - log.debug("Called init()"); - try { - HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getSocketFactory()); - HttpsURLConnection.setDefaultHostnameVerifier(InternalSSLSocketFactory.getHostNameVerifier()); - } catch (InternalSSLSocketFactoryException e) { - log.error(e); - } - String localeString = getMyAppletParameter(LOCALE_PARAM_KEY); - if (localeString != null) { - resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE, - new Locale(localeString)); - } else { - resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE); - } - BKUGUIFacade gui = BKUGUIFactory.createGUI(); - gui.init(getContentPane(), localeString); - worker = new BKUWorker(gui, this, resourceBundle); - } + public void init() { + log.debug("Called init()"); + HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory + .getInstance()); + String localeString = getMyAppletParameter(LOCALE_PARAM_KEY); + if (localeString != null) { + resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE, + new Locale(localeString)); + } else { + resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE); + } + BKUGUIFacade gui = BKUGUIFactory.createGUI(); + gui.init(getContentPane(), localeString); + worker = new BKUWorker(gui, this, resourceBundle); + } - public void start() { - log.debug("Called start()"); - workerThread = new Thread(worker); - workerThread.start(); - } + public void start() { + log.debug("Called start()"); + workerThread = new Thread(worker); + workerThread.start(); + } - public void stop() { - log.debug("Called stop()"); - if ((workerThread != null) && (workerThread.isAlive())) { - workerThread.interrupt(); - } - } + public void stop() { + log.debug("Called stop()"); + if ((workerThread != null) && (workerThread.isAlive())) { + workerThread.interrupt(); + } + } - public void destroy() { - log.debug("Called destroy()"); - } + public void destroy() { + log.debug("Called destroy()"); + } - /** - * Applet configuration parameters - * - * @param paramKey - * @return - */ - public String getMyAppletParameter(String paramKey) { - log.info("Getting parameter: "+paramKey+ ": "+ getParameter(paramKey)); - return getParameter(paramKey); - } + /** + * Applet configuration parameters + * + * @param paramKey + * @return + */ + public String getMyAppletParameter(String paramKey) { + log.info("Getting parameter: " + paramKey + ": " + getParameter(paramKey)); + return getParameter(paramKey); + } } 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 f7b5fb2f..042c6a83 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 @@ -34,6 +34,8 @@ import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; import at.gv.egiz.smcc.SignatureCard; import at.gv.egiz.smcc.util.SMCCHelper; +import at.gv.egiz.stal.ErrorResponse; +import at.gv.egiz.stal.InfoboxReadRequest; import at.gv.egiz.stal.QuitRequest; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; @@ -107,6 +109,8 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, gui.showWelcomeDialog(); try { stalPort = getSTALPort(); + + } catch (Exception e) { log.fatal("Failed to call STAL service.", e); actionCommandList.clear(); @@ -134,7 +138,26 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, GetNextRequestResponseType resp = stalPort.getNextRequest(nextRequest); log.info("Got " + resp.getRequest().size() + " requests from server."); List stalRequests = resp.getRequest(); - List responses = handleRequest(stalRequests); + boolean handle = true; + for (STALRequest request : stalRequests) { + if (request instanceof InfoboxReadRequest) { + InfoboxReadRequest infobx = (InfoboxReadRequest) request; + if (infobx.getInfoboxIdentifier().equals("IdentityLink")) { + if (infobx.getDomainIdentifier() == null) { + if (!InternalSSLSocketFactory.getInstance().isEgovAgency()) { + handle = false; + } + } + } + } + } + List responses; + if (handle) { + responses = handleRequest(stalRequests); + } else { + responses = new ArrayList(1); + responses.add(new ErrorResponse(6002)); + } log.info("Got " + responses.size() + " responses."); nextRequest = factory.createGetNextRequestType(); nextRequest.setSessionId(sessionId); diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java index ab04d2b6..79c369a2 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java @@ -1,19 +1,19 @@ /* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* * To change this template, choose Tools | Templates * and open the template in the editor. @@ -22,80 +22,139 @@ package at.gv.egiz.bku.online.applet; import java.io.IOException; -import java.security.KeyManagementException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.UnrecoverableKeyException; -import java.security.cert.CertificateException; +import java.net.InetAddress; +import java.net.Socket; +import java.net.UnknownHostException; +import java.security.cert.CertificateParsingException; import java.security.cert.X509Certificate; +import java.util.Collection; +import java.util.List; -import javax.net.ssl.HostnameVerifier; -import javax.net.ssl.KeyManagerFactory; -import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLSession; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLPeerUnverifiedException; +import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; -import javax.net.ssl.X509TrustManager; - -public class InternalSSLSocketFactory { - - private SSLSocketFactory factory; - - public static SSLSocketFactory getSocketFactory() throws InternalSSLSocketFactoryException { - return new InternalSSLSocketFactory().factory; - } - - public static HostnameVerifier getHostNameVerifier() throws InternalSSLSocketFactoryException { - return (new HostnameVerifier() { - @Override - public boolean verify(String hostname, SSLSession session) { - return true; - } - }); - } - - public InternalSSLSocketFactory() throws InternalSSLSocketFactoryException { - SSLContext sslContext; - try { - sslContext = SSLContext.getInstance("TLSv1"); - sslContext.getClientSessionContext().setSessionTimeout(0); - KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance("SunX509"); - - KeyStore keyStore = KeyStore.getInstance("JKS"); - keyStore.load(null, null); - keyManagerFactory.init(keyStore, null); - - sslContext.init(keyManagerFactory.getKeyManagers(), - new X509TrustManager[] { new AcceptAllTrustManager() }, - null); - } catch (NoSuchAlgorithmException e) { - throw new InternalSSLSocketFactoryException(e); - } catch (CertificateException e) { - throw new InternalSSLSocketFactoryException(e); - } catch (IOException e) { - throw new InternalSSLSocketFactoryException(e); - } catch (KeyStoreException e) { - throw new InternalSSLSocketFactoryException(e); - } catch (UnrecoverableKeyException e) { - throw new InternalSSLSocketFactoryException(e); - } catch (KeyManagementException e) { - throw new InternalSSLSocketFactoryException(e); - } - - this.factory = sslContext.getSocketFactory(); - } - - class AcceptAllTrustManager implements X509TrustManager { - - public X509Certificate[] getAcceptedIssuers() { - return null; - } - - public void checkClientTrusted(X509Certificate[] chain, String authType) { - } - - public void checkServerTrusted(X509Certificate[] chain, String authType) { - //FIXME - } - } -}; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class InternalSSLSocketFactory extends SSLSocketFactory { + + private static InternalSSLSocketFactory instance = new InternalSSLSocketFactory(); + + private final static Log log = LogFactory + .getLog(InternalSSLSocketFactory.class); + + private final static String GOV_DOMAIN = ".gv.at"; + + private SSLSocket sslSocket; + + private SSLSocketFactory proxy; + + private InternalSSLSocketFactory() { + proxy = HttpsURLConnection.getDefaultSSLSocketFactory(); + } + + public static InternalSSLSocketFactory getInstance() { + return instance; + } + + @Override + public Socket createSocket() throws IOException { + sslSocket = (SSLSocket) proxy.createSocket(); + return sslSocket; + } + + @Override + public Socket createSocket(String arg0, int arg1) throws IOException, + UnknownHostException { + sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1); + + return sslSocket; + } + + @Override + public Socket createSocket(InetAddress arg0, int arg1) throws IOException { + sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1); + return sslSocket; + } + + @Override + public Socket createSocket(String arg0, int arg1, InetAddress arg2, int arg3) + throws IOException, UnknownHostException { + sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1, arg2, arg3); + return sslSocket; + } + + @Override + public Socket createSocket(InetAddress arg0, int arg1, InetAddress arg2, + int arg3) throws IOException { + sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1, arg2, arg3); + return sslSocket; + } + + @Override + public Socket createSocket(Socket arg0, String arg1, int arg2, boolean arg3) + throws IOException { + sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1, arg2, arg3); + return sslSocket; + } + + @Override + public String[] getDefaultCipherSuites() { + return proxy.getDefaultCipherSuites(); + } + + @Override + public String[] getSupportedCipherSuites() { + return proxy.getSupportedCipherSuites(); + } + + public boolean isEgovAgency() { + log.info("Checking if server is egov agency"); + if (sslSocket != null) { + try { + X509Certificate cert = (X509Certificate) sslSocket.getSession() + .getPeerCertificates()[0]; + log.info("Server cert: " + cert); + return isGovAgency(cert); + } catch (SSLPeerUnverifiedException e) { + log.error(e); + return false; + } + } + log.info("Not a SSL connection"); + return false; + } + + public static boolean isGovAgency(X509Certificate cert) { + String[] rdns = (cert.getSubjectX500Principal().getName()).split(","); + for (String rdn : rdns) { + if (rdn.startsWith("CN=")) { + String dns = rdn.split("=")[1]; + if (dns.endsWith(GOV_DOMAIN)) { + return true; + } + } + } + try { + Collection> sanList = cert.getSubjectAlternativeNames(); + if (sanList != null) { + for (List san : sanList) { + if ((Integer) san.get(0) == 2) { + String dns = (String) san.get(1); + if (dns.endsWith(GOV_DOMAIN)) { + return true; + } + } + } + } + } catch (CertificateParsingException e) { + log.error(e); + } + if (cert.getExtensionValue("1.2.40.0.10.1.1.1") != null) { + return true; + } + return false; + } +} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java deleted file mode 100644 index c620284a..00000000 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactoryException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -package at.gv.egiz.bku.online.applet; - -/** - * - * @author mcentner - */ -public class InternalSSLSocketFactoryException extends Exception { - - public InternalSSLSocketFactoryException(Throwable cause) { - super(cause); - } - - public InternalSSLSocketFactoryException(String message, Throwable cause) { - super(message, cause); - } - - public InternalSSLSocketFactoryException(String message) { - super(message); - } - - public InternalSSLSocketFactoryException() { - } - -} -- cgit v1.2.3 From a3361b40aa8f92849c50db27e349e17b87bebb1e Mon Sep 17 00:00:00 2001 From: wbauer Date: Tue, 9 Sep 2008 12:40:52 +0000 Subject: improved security handling and added shutdown handler git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@27 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../online/applet/InternalSSLSocketFactory.java | 4 +- .../at/gv/egiz/bku/online/conf/Configurator.java | 8 +-- .../gv/egiz/bku/online/webapp/ResultServlet.java | 3 +- .../gv/egiz/bku/online/webapp/ShutdownHandler.java | 31 ++++++++ .../egiz/bku/online/conf/accessControlConfig.xml | 3 +- .../src/main/webapp/WEB-INF/applicationContext.xml | 6 +- .../accesscontroller/AuthenticationClassifier.java | 82 +++++++++++++++------- .../egiz/bku/binding/BindingProcessorManager.java | 4 +- .../bku/binding/BindingProcessorManagerImpl.java | 11 ++- .../AuthenticationClassifierTest.java | 28 ++++++++ .../egiz/bku/accesscontroller/www.a-trust.at.crt | 28 ++++++++ 11 files changed, 169 insertions(+), 39 deletions(-) create mode 100644 BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ShutdownHandler.java create mode 100644 bkucommon/src/test/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifierTest.java create mode 100644 bkucommon/src/test/resources/at/gv/egiz/bku/accesscontroller/www.a-trust.at.crt (limited to 'BKUApplet') diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java index 79c369a2..fa3587e4 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java @@ -40,13 +40,13 @@ import org.apache.commons.logging.LogFactory; public class InternalSSLSocketFactory extends SSLSocketFactory { + private final static String GOV_DOMAIN = ".gv.at"; + private static InternalSSLSocketFactory instance = new InternalSSLSocketFactory(); private final static Log log = LogFactory .getLog(InternalSSLSocketFactory.class); - private final static String GOV_DOMAIN = ".gv.at"; - private SSLSocket sslSocket; private SSLSocketFactory proxy; diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/conf/Configurator.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/conf/Configurator.java index a0a268e4..de577139 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/conf/Configurator.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/conf/Configurator.java @@ -52,9 +52,9 @@ public class Configurator { protected void configureProviders() { log.debug("Registering security providers"); - Security.insertProviderAt(new IAIK(), 1); - Security.insertProviderAt(new ECCProvider(false), 2); - Security.addProvider(new STALProvider()); + Security.insertProviderAt(new IAIK(), 1); + Security.insertProviderAt(new ECCProvider(false), 2); + Security.addProvider(new STALProvider()); XSecProvider.addAsProvider(false); StringBuilder sb = new StringBuilder(); sb.append("Registered providers: "); @@ -65,7 +65,7 @@ public class Configurator { log.debug(sb.toString()); } - public void configure() { + public void configure() { configureProviders(); configUrlConnections(); } diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java index 6c1a4c3a..bc3edf18 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java @@ -115,6 +115,7 @@ public class ResultServlet extends SpringBKUServlet { resp.setContentType(bp.getResultContentType()); resp.setCharacterEncoding(encoding); bp.writeResultTo(resp.getOutputStream(), encoding); - session.invalidate(); + session.invalidate(); + getBindingProcessorManager().removeBindingProcessor(bp.getId()); } } diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ShutdownHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ShutdownHandler.java new file mode 100644 index 00000000..86da6c06 --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ShutdownHandler.java @@ -0,0 +1,31 @@ +package at.gv.egiz.bku.online.webapp; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.springframework.context.ApplicationEvent; +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextClosedEvent; + +import at.gv.egiz.bku.binding.BindingProcessorManager; + +public class ShutdownHandler implements ApplicationListener { + + private static Log log = LogFactory.getLog(ShutdownHandler.class); + + private BindingProcessorManager bindingProcessorManager; + + public void setBindingProcessorManager( + BindingProcessorManager bindingProcessorManager) { + this.bindingProcessorManager = bindingProcessorManager; + } + + @Override + public void onApplicationEvent(ApplicationEvent event) { + if (event instanceof ContextClosedEvent) { + log.info("Shutting down BKU"); + bindingProcessorManager.shutdownNow(); + } + + } + +} diff --git a/BKUOnline/src/main/resources/at/gv/egiz/bku/online/conf/accessControlConfig.xml b/BKUOnline/src/main/resources/at/gv/egiz/bku/online/conf/accessControlConfig.xml index 69b45d1b..f8d1411c 100644 --- a/BKUOnline/src/main/resources/at/gv/egiz/bku/online/conf/accessControlConfig.xml +++ b/BKUOnline/src/main/resources/at/gv/egiz/bku/online/conf/accessControlConfig.xml @@ -54,8 +54,7 @@ certified - - + IdentityLink derived diff --git a/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml b/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml index 4bb5e8e2..f87d09f5 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml +++ b/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml @@ -49,5 +49,9 @@ scope="singleton" init-method="configure"> - + + + + + \ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifier.java b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifier.java index ace8a75a..ed4b9bda 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifier.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifier.java @@ -1,30 +1,31 @@ /* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package at.gv.egiz.bku.accesscontroller; import static at.gv.egiz.bku.accesscontroller.AuthenticationClass.ANONYMOUS; import static at.gv.egiz.bku.accesscontroller.AuthenticationClass.CERTIFIED; -import static at.gv.egiz.bku.accesscontroller.AuthenticationClass.PSEUDO_ANONYMOUS; import static at.gv.egiz.bku.accesscontroller.AuthenticationClass.CERTIFIED_GOV_AGENCY; +import static at.gv.egiz.bku.accesscontroller.AuthenticationClass.PSEUDO_ANONYMOUS; -import java.net.InetAddress; import java.net.URL; -import java.net.UnknownHostException; +import java.security.cert.CertificateParsingException; import java.security.cert.X509Certificate; +import java.util.Collection; +import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -37,6 +38,39 @@ public class AuthenticationClassifier { private AuthenticationClassifier() { } + public static boolean isGovAgency(X509Certificate cert) { + String[] rdns = (cert.getSubjectX500Principal().getName()).split(","); + for (String rdn : rdns) { + if (rdn.startsWith("CN=")) { + String dns = rdn.split("=")[1]; + log.trace("Analyzing cn dn: " + dns); + if (dns.endsWith(GOV_DOMAIN)) { + return true; + } + } + } + try { + Collection> sanList = cert.getSubjectAlternativeNames(); + if (sanList != null) { + for (List san : sanList) { + log.trace("Analyzing subj. alt name: " + san); + if ((Integer) san.get(0) == 2) { + String dns = (String) san.get(1); + if (dns.endsWith(GOV_DOMAIN)) { + return true; + } + } + } + } + } catch (CertificateParsingException e) { + log.error(e); + } + if (cert.getExtensionValue("1.2.40.0.10.1.1.1") != null) { + return true; + } + return false; + } + /** * Client Certificates are currently not supported * @@ -45,13 +79,8 @@ public class AuthenticationClassifier { URL url, X509Certificate cert) { if (isDataUrl) { if (url.getProtocol().equalsIgnoreCase("https")) { - try { - if (InetAddress.getByName(url.getHost()).getCanonicalHostName() - .endsWith(GOV_DOMAIN)) { - return CERTIFIED_GOV_AGENCY; - } - } catch (UnknownHostException e) { - log.error("Cannot determine host name", e); + if (isGovAgency(cert)) { + return CERTIFIED_GOV_AGENCY; } if (cert.getExtensionValue("1.2.40.0.10.1.1.1") != null) { return CERTIFIED_GOV_AGENCY; @@ -68,7 +97,8 @@ public class AuthenticationClassifier { /** * * @param isDataUrl - * @param url if the url's protocol is https a cert parameter must be provided. + * @param url + * if the url's protocol is https a cert parameter must be provided. * @param cert * @return */ diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManager.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManager.java index ed37f08f..aaf81e51 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManager.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManager.java @@ -99,5 +99,7 @@ public interface BindingProcessorManager { */ public Set getManagedIds(); - public void shutdown(); + public void shutdown(); + + public void shutdownNow(); } \ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java index 6f5ca2d2..0082de26 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java @@ -149,6 +149,11 @@ public class BindingProcessorManagerImpl implements BindingProcessorManager { public void shutdown() { log.info("Shutting down the BindingProcessorManager"); executorService.shutdown(); + } + + public void shutdownNow() { + log.info("Shutting down the BindingProcessorManager NOW!"); + executorService.shutdownNow(); } /** @@ -223,7 +228,8 @@ public class BindingProcessorManagerImpl implements BindingProcessorManager { throw new SLRuntimeException( "Clashing ids, cannot process bindingprocessor with id:" + aBindingProcessor.getId()); - } + } + log.debug("processing bindingprocessor: "+aBindingProcessor.getId()); Future f = executorService.submit(aBindingProcessor); bindingProcessorMap.put(aBindingProcessor.getId(), new MapEntityWrapper(f, aBindingProcessor)); @@ -235,7 +241,8 @@ public class BindingProcessorManagerImpl implements BindingProcessorManager { } @Override - public void removeBindingProcessor(Id sessionId) { + public void removeBindingProcessor(Id sessionId) { + log.debug("Removing binding processor: "+sessionId); MapEntityWrapper wrapper = bindingProcessorMap .get(sessionId); if (wrapper == null) { diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifierTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifierTest.java new file mode 100644 index 00000000..c339704e --- /dev/null +++ b/bkucommon/src/test/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifierTest.java @@ -0,0 +1,28 @@ +package at.gv.egiz.bku.accesscontroller; + +import static org.junit.Assert.assertTrue; + +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; + +import org.junit.Before; +import org.junit.Test; + +public class AuthenticationClassifierTest { + + private X509Certificate atrust; + + @Before + public void setUp() throws Exception { + atrust = (X509Certificate) CertificateFactory.getInstance("X509") + .generateCertificate( + getClass().getClassLoader().getResourceAsStream( + "at/gv/egiz/bku/accesscontroller/www.a-trust.at.crt")); + } + + @Test + public void testATrust() { + assertTrue(AuthenticationClassifier.isGovAgency(atrust)); + } + +} diff --git a/bkucommon/src/test/resources/at/gv/egiz/bku/accesscontroller/www.a-trust.at.crt b/bkucommon/src/test/resources/at/gv/egiz/bku/accesscontroller/www.a-trust.at.crt new file mode 100644 index 00000000..11cde026 --- /dev/null +++ b/bkucommon/src/test/resources/at/gv/egiz/bku/accesscontroller/www.a-trust.at.crt @@ -0,0 +1,28 @@ +-----BEGIN CERTIFICATE----- +MIIEyjCCA7KgAwIBAgIDA4LFMA0GCSqGSIb3DQEBBQUAMIGHMQswCQYDVQQGEwJB +VDFIMEYGA1UECgw/QS1UcnVzdCBHZXMuIGYuIFNpY2hlcmhlaXRzc3lzdGVtZSBp +bSBlbGVrdHIuIERhdGVudmVya2VociBHbWJIMRYwFAYDVQQLDA1hLXNpZ24tU1NM +LTAzMRYwFAYDVQQDDA1hLXNpZ24tU1NMLTAzMB4XDTA3MTIxMTExMTQ0NFoXDTEy +MTIxMTExMTQ0NFowYTELMAkGA1UEBhMCQVQxEDAOBgNVBAoMB0EtVHJ1c3QxEDAO +BgNVBAsMB0EtVHJ1c3QxFzAVBgNVBAMMDnd3dy5hLXRydXN0LmF0MRUwEwYDVQQF +Eww2NDk2ODY0MDkzMzkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAK2oRtJ4 +R9ipr/NUH5F4p86cjWtzT1g+ytpjg1lwh4HNY+lTjdUcx/VKBrtf0N8qnMK1UHhA +LLvvZeKTFi3L15i5or1WjZRi4RfH/4vcL0o1w/91liwMOKH3D30omnVceuxmQp2j +V9QrGPbz0/IsP51cnBWCBTWGqgfBebB8v1FLAgMBAAGjggHmMIIB4jATBgNVHSME +DDAKgAhAPqHTYrQD3TByBggrBgEFBQcBAQRmMGQwJwYIKwYBBQUHMAGGG2h0dHA6 +Ly9vY3NwLmEtdHJ1c3QuYXQvb2NzcDA5BggrBgEFBQcwAoYtaHR0cDovL3d3dy5h +LXRydXN0LmF0L2NlcnRzL2Etc2lnbi1zc2wtMDMuY3J0MEsGA1UdIAREMEIwQAYG +KigAEQEUMDYwNAYIKwYBBQUHAgEWKGh0dHA6Ly93d3cuYS10cnVzdC5hdC9kb2Nz +L2NwL2Etc2lnbi1zc2wwgY8GA1UdHwSBhzCBhDCBgaB/oH2Ge2xkYXA6Ly9sZGFw +LmEtdHJ1c3QuYXQvb3U9YS1zaWduLVNTTC0wMyxvPUEtVHJ1c3QsYz1BVD9jZXJ0 +aWZpY2F0ZXJldm9jYXRpb25saXN0P2Jhc2U/b2JqZWN0Y2xhc3M9ZWlkQ2VydGlm +aWNhdGlvbkF1dGhvcml0eTARBgNVHQ4ECgQIRu1a/pOZZpMwDgYDVR0PAQH/BAQD +AgWgMEoGA1UdEQRDMEGBEW9mZmljZUBhLXRydXN0LmF0gg53d3cuYS10cnVzdC5h +dIIcemRhLnNvemlhbHZlcnNpY2hlcnVuZy5ndi5hdDAJBgNVHRMEAjAAMA0GCSqG +SIb3DQEBBQUAA4IBAQCQGheDpci0lnSEoKw/N3tbJqn/KG49/OWZcsw6XZiAEHsx +Rx9TlNJhL2d/SqFXBmmqfR496gdzTb4823WJsmXtyBY2t5ZnmD9tY5oJi5bHKchO +50QCd1x24HzH1mxPReCJzRxzLEM/znojEMdYqQ5Y+BZuj7n9BY+l2nY0Qnhn09FE +dxXAfNcuZnZavLJgk7vTBg8OFkAh6DJ21ACxf/y+rN53gKFK4Jh+PodRu0J2tK8B +wAZg7HlnT8U7tcEsf1JnsBhlzAWCHgZc6whgBbDHFs6WSFWuobKN+maU91g/Tvgk +Obos/EhVNti54Zhu1PO9RSKpKkwzTJT4kmGtaOJN +-----END CERTIFICATE----- -- cgit v1.2.3 From bdc1c691b571e55f6806d3ac9bc3dad4fcb2691d Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 10 Sep 2008 16:53:40 +0000 Subject: waitDialog git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@29 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'BKUApplet') 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 042c6a83..51ac243c 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 @@ -272,7 +272,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, } break; case SMCCHelper.CARD_FOUND: - gui.showWelcomeDialog(); + gui.showWaitDialog(null); signatureCard = smccHelper.getSignatureCard(errorMessages.getLocale()); return false; } -- cgit v1.2.3 From 3794536434fdbb06067eddcfd248898ce85f85a1 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 12 Sep 2008 13:06:34 +0000 Subject: gui 0.2 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@34 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 102 ++- .../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 885 ++++++++++----------- .../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 2 + .../at/gv/egiz/bku/gui/HashDataTableModel.java | 71 ++ .../main/java/at/gv/egiz/bku/gui/MimeFilter.java | 98 +++ .../main/java/at/gv/egiz/bku/gui/PinDocument.java | 58 ++ .../at/gv/egiz/bku/gui/Messages.properties | 15 +- .../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 276 +++---- BKUOnline/pom.xml | 13 +- .../gv/egiz/bku/smccstal/SignRequestHandler.java | 6 +- 10 files changed, 840 insertions(+), 686 deletions(-) create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/MimeFilter.java create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java (limited to 'BKUApplet') 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 8289f30b..c7df0871 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 @@ -34,63 +34,59 @@ import at.gv.egiz.bku.gui.BKUGUIFactory; */ public class BKUApplet extends JApplet { - private static Log log = LogFactory.getLog(BKUApplet.class); + private static Log log = LogFactory.getLog(BKUApplet.class); + 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"; + public final static String SESSION_ID = "SessionID"; + protected ResourceBundle resourceBundle; + protected BKUWorker worker; + protected Thread workerThread; - public final static String RESOURCE_BUNDLE_BASE = "at/gv/egiz/bku/online/applet/Messages"; + public BKUApplet() { + } - public final static String LOCALE_PARAM_KEY = "Locale"; - public final static String LOGO_URL_KEY = "LogoURL"; - public final static String WSDL_URL = "WSDL_URL"; - public final static String SESSION_ID = "SessionID"; + public void init() { + log.debug("Called init()"); + HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance()); + String localeString = getMyAppletParameter(LOCALE_PARAM_KEY); + if (localeString != null) { + resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE, + new Locale(localeString)); + } else { + resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE); + } + BKUGUIFacade gui = BKUGUIFactory.createGUI(); + gui.init(getContentPane(), localeString); + worker = new BKUWorker(gui, this, resourceBundle); + } - protected ResourceBundle resourceBundle; - protected BKUWorker worker; - protected Thread workerThread; + public void start() { + log.debug("Called start()"); + workerThread = new Thread(worker); + workerThread.start(); + } - public BKUApplet() { - } + public void stop() { + log.debug("Called stop()"); + if ((workerThread != null) && (workerThread.isAlive())) { + workerThread.interrupt(); + } + } - public void init() { - log.debug("Called init()"); - HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory - .getInstance()); - String localeString = getMyAppletParameter(LOCALE_PARAM_KEY); - if (localeString != null) { - resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE, - new Locale(localeString)); - } else { - resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE); - } - BKUGUIFacade gui = BKUGUIFactory.createGUI(); - gui.init(getContentPane(), localeString); - worker = new BKUWorker(gui, this, resourceBundle); - } + public void destroy() { + log.debug("Called destroy()"); + } - public void start() { - log.debug("Called start()"); - workerThread = new Thread(worker); - workerThread.start(); - } - - public void stop() { - log.debug("Called stop()"); - if ((workerThread != null) && (workerThread.isAlive())) { - workerThread.interrupt(); - } - } - - public void destroy() { - log.debug("Called destroy()"); - } - - /** - * Applet configuration parameters - * - * @param paramKey - * @return - */ - public String getMyAppletParameter(String paramKey) { - log.info("Getting parameter: " + paramKey + ": " + getParameter(paramKey)); - return getParameter(paramKey); - } + /** + * Applet configuration parameters + * + * @param paramKey + * @return + */ + public String getMyAppletParameter(String paramKey) { + log.info("Getting parameter: " + paramKey + ": " + getParameter(paramKey)); + return getParameter(paramKey); + } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java index 044e6927..584dba1a 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java @@ -27,6 +27,7 @@ import java.awt.Component; import java.awt.Container; import java.awt.Cursor; import java.awt.Dimension; +import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -75,13 +76,11 @@ import org.apache.commons.logging.LogFactory; * @author clemens */ public class BKUGUI implements BKUGUIFacade { - + private static final Log log = LogFactory.getLog(BKUGUI.class); public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages"; public static final String LOGO_RESOURCE = "/images/logo.png"; -// public static final int MAIN_PANEL_WIDTH = 100; -// public static final int MAIN_PANEL_HEIGHT = 20; -// public static final int PREF_SIZE_PINFIELD = 118; + public static final String HASHDATA_FONT = "Monospaced"; public static final Color ERROR_COLOR = Color.RED; public static final Color HYPERLINK_COLOR = Color.BLUE; private static final String TITLE_WELCOME = "title.welcome"; @@ -94,6 +93,7 @@ public class BKUGUI implements BKUGUIFacade { private static final String TITLE_WAIT = "title.wait"; private static final String TITLE_HASHDATA = "title.hashdata"; private static final String WINDOWTITLE_SAVE = "windowtitle.save"; + private static final String WINDOWTITLE_SAVEDIR = "windowtitle.savedir"; private static final String WINDOWTITLE_OVERWRITE = "windowtitle.overwrite"; private static final String MESSAGE_WAIT = "message.wait"; private static final String MESSAGE_INSERTCARD = "message.insertcard"; @@ -104,19 +104,13 @@ public class BKUGUI implements BKUGUIFacade { private static final String MESSAGE_OVERWRITE = "message.overwrite"; private static final String LABEL_PIN = "label.pin"; private static final String LABEL_PINSIZE = "label.pinsize"; - private static final String ERROR_HASHDATA = "error.hashdata"; + private static final String ERROR_NO_HASHDATA = "error.no.hashdata"; private static final String BUTTON_OK = "button.ok"; private static final String BUTTON_CANCEL = "button.cancel"; private static final String BUTTON_BACK = "button.back"; private static final String BUTTON_SIGN = "button.sign"; private static final String BUTTON_SAVE = "button.save"; - private static final String MIMETYPE_DESC_XML = "mimetype.desc.xml"; - private static final String MIMETYPE_DESC_HTML = "mimetype.desc.html"; - private static final String MIMETYPE_DESC_XHTML = "mimetype.desc.xhtml"; - private static final String MIMETYPE_DESC_TXT = "mimetype.desc.txt"; - private static final String MIMETYPE_DESC_PDF = "mimetype.desc.pdf"; - private static final String MIMETYPE_DESC_BIN = "mimetype.desc.bin"; private static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix"; protected Container contentPane; protected ResourceBundle messages; @@ -132,11 +126,11 @@ public class BKUGUI implements BKUGUIFacade { /** remember the pinfield to return to worker */ protected JPasswordField pinField; - protected JButton okButton; - protected JButton cancelButton; - protected JButton signButton; - protected JButton saveButton; - protected JButton backButton; +// protected JButton okButton; +// protected JButton cancelButton; +// protected JButton signButton; +// protected JButton saveButton; +// protected JButton backButton; protected int buttonSize; private static final int CHECKBOX_WIDTH = new JCheckBox().getPreferredSize().width; @@ -216,28 +210,43 @@ public class BKUGUI implements BKUGUIFacade { java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2)); // titleLabel.setForeground(defaultForground); - okButton = new JButton(); - okButton.setText(messages.getString(BUTTON_OK)); - cancelButton = new JButton(); - cancelButton.setText(messages.getString(BUTTON_CANCEL)); - signButton = new JButton(); - signButton.setText(messages.getString(BUTTON_SIGN)); - backButton = new JButton(); - backButton.setText(messages.getString(BUTTON_BACK)); - saveButton = new JButton(); - saveButton.setText(messages.getString(BUTTON_SAVE)); +// okButton = new JButton(); +// okButton.setText(messages.getString(BUTTON_OK)); +// cancelButton = new JButton(); +// cancelButton.setText(messages.getString(BUTTON_CANCEL)); +// signButton = new JButton(); +// signButton.setText(messages.getString(BUTTON_SIGN)); +// backButton = new JButton(); +// backButton.setText(messages.getString(BUTTON_BACK)); +// saveButton = new JButton(); +// saveButton.setText(messages.getString(BUTTON_SAVE)); // contentPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton); - if (okButton.getPreferredSize().width > buttonSize) - buttonSize = okButton.getPreferredSize().width; - if (cancelButton.getPreferredSize().width > buttonSize) - buttonSize = cancelButton.getPreferredSize().width; - if (signButton.getPreferredSize().width > buttonSize) - buttonSize = signButton.getPreferredSize().width; - if (backButton.getPreferredSize().width > buttonSize) - buttonSize = backButton.getPreferredSize().width; - if (saveButton.getPreferredSize().width > buttonSize) - buttonSize = saveButton.getPreferredSize().width; + JButton b = new JButton(); + b.setText(messages.getString(BUTTON_CANCEL)); + if (b.getPreferredSize().width > buttonSize) + buttonSize = b.getPreferredSize().width; + b.setText(messages.getString(BUTTON_OK)); + if (b.getPreferredSize().width > buttonSize) + buttonSize = b.getPreferredSize().width; + b.setText(messages.getString(BUTTON_SIGN)); + if (b.getPreferredSize().width > buttonSize) + buttonSize = b.getPreferredSize().width; + b.setText(messages.getString(BUTTON_BACK)); + if (b.getPreferredSize().width > buttonSize) + buttonSize = b.getPreferredSize().width; + b.setText(messages.getString(BUTTON_SAVE)); + if (b.getPreferredSize().width > buttonSize) + buttonSize = b.getPreferredSize().width; + +// if (cancelButton.getPreferredSize().width > buttonSize) +// buttonSize = cancelButton.getPreferredSize().width; +// if (signButton.getPreferredSize().width > buttonSize) +// buttonSize = signButton.getPreferredSize().width; +// if (backButton.getPreferredSize().width > buttonSize) +// buttonSize = backButton.getPreferredSize().width; +// if (saveButton.getPreferredSize().width > buttonSize) +// buttonSize = saveButton.getPreferredSize().width; GroupLayout headerPanelLayout = new GroupLayout(headerPanel); @@ -349,6 +358,8 @@ public class BKUGUI implements BKUGUIFacade { titleLabel.setText(messages.getString(TITLE_INSERTCARD)); + JButton cancelButton = new JButton(); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); cancelButton.addActionListener(cancelListener); cancelButton.setActionCommand(cancelCommand); @@ -400,6 +411,8 @@ public class BKUGUI implements BKUGUIFacade { // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(errorMsgLabel)); + JButton cancelButton = new JButton(); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); cancelButton.addActionListener(cancelListener); cancelButton.setActionCommand(cancelCommand); @@ -439,9 +452,13 @@ public class BKUGUI implements BKUGUIFacade { titleLabel.setText(messages.getString(TITLE_RETRY)); } + JButton cancelButton = new JButton(); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); cancelButton.setActionCommand(cancelCommand); cancelButton.addActionListener(cancelListener); + JButton okButton = new JButton(); + okButton.setText(messages.getString(BUTTON_OK)); okButton.setEnabled(false); okButton.setActionCommand(okCommand); okButton.addActionListener(okListener); @@ -592,9 +609,13 @@ public class BKUGUI implements BKUGUIFacade { titleLabel.setText(messages.getString(TITLE_RETRY)); } + JButton cancelButton = new JButton(); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); cancelButton.setActionCommand(cancelCommand); cancelButton.addActionListener(cancelListener); + JButton signButton = new JButton(); + signButton.setText(messages.getString(BUTTON_SIGN)); signButton.setEnabled(false); signButton.setActionCommand(signCommand); signButton.addActionListener(signListener); @@ -764,6 +785,8 @@ public class BKUGUI implements BKUGUIFacade { mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(errorMsgLabel)); + JButton okButton = new JButton(); + okButton.setText(messages.getString(BUTTON_OK)); okButton.setActionCommand(okCommand); okButton.addActionListener(okListener); @@ -790,343 +813,386 @@ public class BKUGUI implements BKUGUIFacade { @Override public void showErrorDialog(final String errorMsg) { - SwingUtilities.invokeLater(new Runnable() { + SwingUtilities.invokeLater(new Runnable() { - public void run() { - mainPanel.removeAll(); - buttonPanel.removeAll(); + @Override + public void run() { + mainPanel.removeAll(); + buttonPanel.removeAll(); - titleLabel.setText(messages.getString(TITLE_ERROR)); + titleLabel.setText(messages.getString(TITLE_ERROR)); // titleLabel.setForeground(defaultForground); - JLabel errorMsgLabel = new JLabel(); - errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - errorMsgLabel.setText("" + errorMsg + ""); - errorMsgLabel.setForeground(ERROR_COLOR); + JLabel errorMsgLabel = new JLabel(); + errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + errorMsgLabel.setText("" + errorMsg + ""); + errorMsgLabel.setForeground(ERROR_COLOR); - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createSequentialGroup() // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(errorMsgLabel) - .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(errorMsgLabel)); + .addComponent(errorMsgLabel) + .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(errorMsgLabel)); - contentPanel.validate(); - } - }); + contentPanel.validate(); + } + }); } @Override public void showHashDataInputDialog(final List signedReferences, final ActionListener okListener, final String okCommand) { - SwingUtilities.invokeLater(new Runnable() { + + if (signedReferences == null) { + showErrorDialog(messages.getString(ERROR_NO_HASHDATA), okListener, okCommand); + } + + if (signedReferences.size() == 1) { + +// final HashDataInput signedRef = signedReferences.get(0); + + if ("text/plain".equals(signedReferences.get(0).getMimeType())) { + + ActionListener saveHashDataListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + showSaveHashDataInputDialog(signedReferences, okListener, okCommand); + } + }; + String hashDataText = getText(signedReferences.get(0)); + if (hashDataText != null) { + showPlainTextHashDataInputDialog(hashDataText, saveHashDataListener, "save", okListener, okCommand); + } else { + showErrorDialog(messages.getString(ERROR_NO_HASHDATA), okListener, okCommand); + } + + } else { + showSaveHashDataInputDialog(signedReferences, okListener, okCommand); + } + + } else { - @Override - public void run() { + final HashDataTableModel tableModel = new HashDataTableModel(signedReferences); - if (signedReferences != null && signedReferences.size() == 1) { - - final HashDataInput signedRef = signedReferences.get(0); - if ("text/plain".equals(signedRef.getMimeType())) { - //TODO get encoding from mimetype - //read directly to byte[] since hashDataIS is backed by byte[] ? - ByteArrayOutputStream baos = null; - try { - String refId = signedRef.getReferenceId(); - InputStream hashDataIS = signedRef.getHashDataInput(); - if (hashDataIS == null) { - showErrorDialog("Failed to obtain HashDataInput for reference " + refId, okListener, okCommand); - } else { - baos = new ByteArrayOutputStream(hashDataIS.available()); - int c; - while ((c = hashDataIS.read()) != -1) { - baos.write(c); - } - String text = baos.toString("UTF-8"); - - ActionListener al = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - showSaveHashDataInputDialog(signedRef, okListener, okCommand); - } - }; - showPlainTextHashDataInputDialog(text, refId, okListener, okCommand, al, "save"); - } - } catch (IOException ex) { - showErrorDialog("Failed to read HashDataInput for reference " + signedRef.getReferenceId() + ": " + ex.getMessage(), okListener, okCommand); - } finally { - try { - baos.close(); - } catch (IOException ex) { - } - } - } else { - showSaveHashDataInputDialog(signedRef, okListener, okCommand); - } + ActionListener saveHashDataListener = new ActionListener() { - } else if (signedReferences != null && signedReferences.size() > 1) { - final HashDataTableModel tableModel = new HashDataTableModel(signedReferences); - - ActionListener al = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - List selection = tableModel.getSelectedReferenceIds(); - StringBuilder sb = new StringBuilder("Not implemented yet. \n"); - for (String string : selection) { - sb.append(string); - sb.append('\n'); - } - showErrorDialog(sb.toString(), okListener, okCommand); -// showSaveHashDataInputDialog(signedRef, okListener, okCommand); - } - }; - showMultipleHashDataInputDialog(tableModel, okListener, okCommand, al, "save"); - } else { - showErrorDialog(messages.getString(ERROR_HASHDATA), okListener, okCommand); - } + @Override + public void actionPerformed(ActionEvent e) { + showSaveHashDataInputDialog(tableModel.getSelectedHashData(), okListener, okCommand); } - }); + }; + showMultipleHashDataInputDialog(tableModel, okListener, okCommand, saveHashDataListener, "save"); + } + } + + private static String getText(HashDataInput hdi) { + ByteArrayOutputStream baos = null; + try { + InputStream hashDataIS = hdi.getHashDataInput(); + if (hashDataIS == null) { + log.error("No HashDataInput stream for reference " + hdi.getReferenceId()); + return null; + } else { + baos = new ByteArrayOutputStream(hashDataIS.available()); + int c; + while ((c = hashDataIS.read()) != -1) { + baos.write(c); + } + return baos.toString("UTF-8"); + } + } catch (IOException ex) { + log.error("Failed to read HashDataInput for reference " + hdi.getReferenceId() + ": " + ex.getMessage()); + return null; + } finally { + try { + baos.close(); + } catch (IOException ex) { + } + } } - private void showPlainTextHashDataInputDialog(String text, String refId, ActionListener cancelListener, String cancelCommand, ActionListener saveListener, String saveCommand) { - mainPanel.removeAll(); - buttonPanel.removeAll(); + private void showPlainTextHashDataInputDialog(final String hashDataText, final ActionListener saveListener, final String saveCommand, final ActionListener cancelListener, final String cancelCommand) { + SwingUtilities.invokeLater(new Runnable() { - titleLabel.setText(messages.getString(TITLE_HASHDATA)); + @Override + public void run() { + mainPanel.removeAll(); + buttonPanel.removeAll(); + + titleLabel.setText(messages.getString(TITLE_HASHDATA)); + + JLabel refIdLabel = new JLabel(); + refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + refIdLabel.setText(messages.getString(MESSAGE_HASHDATA)); //MessageFormat.format(refIdLabelPattern, new Object[]{refId})); + + JScrollPane hashDataScrollPane = new JScrollPane(); + JTextArea hashDataTextArea = new JTextArea(hashDataText); + hashDataTextArea.setEditable(false); + hashDataTextArea.setColumns(1); + hashDataTextArea.setRows(1); + hashDataTextArea.setFont(new Font(HASHDATA_FONT, hashDataTextArea.getFont().getStyle(), hashDataTextArea.getFont().getSize())); + hashDataScrollPane.setViewportView(hashDataTextArea); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createSequentialGroup() + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(refIdLabel) + .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addComponent(refIdLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(hashDataScrollPane, 0, GroupLayout.PREFERRED_SIZE, hashDataTextArea.getPreferredSize().height+3)); + + + + // GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + // mainPanel.setLayout(mainPanelLayout); + // + // mainPanelLayout.setHorizontalGroup( + // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(refIdLabel).addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)).addContainerGap())); + // + // mainPanelLayout.setVerticalGroup( + // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addComponent(refIdLabel).addGap(refIdLabel.getFont().getSize()).addComponent(hashDataScrollPane).addGap(refIdLabel.getFont().getSize()))); + + JButton backButton = new JButton(); + backButton.setText(messages.getString(BUTTON_BACK)); + backButton.setActionCommand(cancelCommand); + backButton.addActionListener(cancelListener); + + JButton saveButton = new JButton(); + saveButton.setText(messages.getString(BUTTON_SAVE)); + saveButton.setActionCommand(saveCommand); + saveButton.addActionListener(saveListener); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + // buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton); + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) + .addContainerGap()); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(saveButton) + .addComponent(backButton)); + + + // GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + // buttonPanel.setLayout(buttonPanelLayout); + // + // buttonPanelLayout.setHorizontalGroup( + // buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE).addComponent(saveButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton).addContainerGap())); + // buttonPanelLayout.setVerticalGroup( + // buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(saveButton).addComponent(cancelButton))); + + contentPanel.validate(); + } + }); + } - JLabel refIdLabel = new JLabel(); - refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - String refIdLabelPattern = messages.getString(MESSAGE_HASHDATA); - refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{refId})); + private void showMultipleHashDataInputDialog(final TableModel signedReferences, final ActionListener cancelListener, final String cancelCommand, final ActionListener saveListener, final String saveCommand) { + SwingUtilities.invokeLater(new Runnable() { - JScrollPane hashDataScrollPane = new JScrollPane(); - JTextArea hashDataTextArea = new JTextArea(text); - hashDataTextArea.setEditable(false); - hashDataTextArea.setColumns(1); - hashDataTextArea.setRows(1); - hashDataScrollPane.setViewportView(hashDataTextArea); + @Override + public void run() { + mainPanel.removeAll(); + buttonPanel.removeAll(); - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); + titleLabel.setText(messages.getString(TITLE_HASHDATA)); - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(refIdLabel) - .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap()); + JLabel refIdLabel = new JLabel(); + refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + String refIdLabelPattern = messages.getString(MESSAGE_HASHDATALIST); + refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.getRowCount()})); - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addComponent(refIdLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(hashDataScrollPane, 0, GroupLayout.PREFERRED_SIZE, hashDataTextArea.getPreferredSize().height+3)); + JTable hashDataTable = new JTable(); + hashDataTable.setModel(signedReferences); + hashDataTable.setTableHeader(null); + // hashDataTable.setShowVerticalLines(false); + // hashDataTable.setRowSelectionAllowed(false); + TableColumn selectCol = hashDataTable.getColumnModel().getColumn(1); + selectCol.setMinWidth(CHECKBOX_WIDTH); + selectCol.setMaxWidth(CHECKBOX_WIDTH); + + + hashDataTable.setPreferredScrollableViewportSize(mainPanel.getPreferredSize()); - - -// GroupLayout mainPanelLayout = new GroupLayout(mainPanel); -// mainPanel.setLayout(mainPanelLayout); -// -// mainPanelLayout.setHorizontalGroup( -// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(refIdLabel).addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)).addContainerGap())); -// -// mainPanelLayout.setVerticalGroup( -// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addComponent(refIdLabel).addGap(refIdLabel.getFont().getSize()).addComponent(hashDataScrollPane).addGap(refIdLabel.getFont().getSize()))); + JScrollPane hashDataScrollPane = new JScrollPane(hashDataTable); - backButton.setActionCommand(cancelCommand); - backButton.addActionListener(cancelListener); + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); - saveButton.setActionCommand(saveCommand); - saveButton.addActionListener(saveListener); - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - -// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton); - buttonPanelLayout.setHorizontalGroup( - buttonPanelLayout.createSequentialGroup() - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) - .addContainerGap()); - buttonPanelLayout.setVerticalGroup( - buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(saveButton) - .addComponent(backButton)); - - -// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); -// buttonPanel.setLayout(buttonPanelLayout); -// -// buttonPanelLayout.setHorizontalGroup( -// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE).addComponent(saveButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton).addContainerGap())); -// buttonPanelLayout.setVerticalGroup( -// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(saveButton).addComponent(cancelButton))); + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createSequentialGroup() + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(refIdLabel) + .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()); - contentPanel.validate(); - } + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addComponent(refIdLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(hashDataScrollPane, 0, GroupLayout.PREFERRED_SIZE, hashDataTable.getPreferredSize().height+3)); + // .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)); - private void showMultipleHashDataInputDialog(final TableModel signedReferences, final ActionListener cancelListener, final String cancelCommand, ActionListener saveListener, String saveCommand) { - mainPanel.removeAll(); - buttonPanel.removeAll(); - - titleLabel.setText(messages.getString(TITLE_HASHDATA)); - - JLabel refIdLabel = new JLabel(); - refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - String refIdLabelPattern = messages.getString(MESSAGE_HASHDATALIST); - refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.getRowCount()})); - - JTable hashDataTable = new JTable(); - hashDataTable.setModel(signedReferences); - hashDataTable.setTableHeader(null); -// hashDataTable.setShowVerticalLines(false); -// hashDataTable.setRowSelectionAllowed(false); - TableColumn selectCol = hashDataTable.getColumnModel().getColumn(1); - selectCol.setMinWidth(CHECKBOX_WIDTH); - selectCol.setMaxWidth(CHECKBOX_WIDTH); - - - hashDataTable.setPreferredScrollableViewportSize(mainPanel.getPreferredSize()); - - JScrollPane hashDataScrollPane = new JScrollPane(hashDataTable); - - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(refIdLabel) - .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap()); - - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addComponent(refIdLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(hashDataScrollPane, 0, GroupLayout.PREFERRED_SIZE, hashDataTable.getPreferredSize().height+3)); -// .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)); - - -// -// GroupLayout mainPanelLayout = new GroupLayout(mainPanel); -// mainPanel.setLayout(mainPanelLayout); -// -// mainPanelLayout.setHorizontalGroup( -// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) -// .addGroup(mainPanelLayout.createSequentialGroup() -// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) -// .addComponent(refIdLabel) -// .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)) -// .addContainerGap())); -// -// mainPanelLayout.setVerticalGroup( -// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) -// .addGroup(mainPanelLayout.createSequentialGroup() -// .addComponent(refIdLabel) -// .addGap(refIdLabel.getFont().getSize()) -// .addComponent(hashDataScrollPane) -// .addGap(refIdLabel.getFont().getSize()))); - - - - - - - - - - - -// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); -// buttonPanel.setLayout(buttonPanelLayout); -// -// buttonPanelLayout.setHorizontalGroup( -// buttonPanelLayout.createSequentialGroup() -//// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) -//// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup() -// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) -// .addComponent(saveButton) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(cancelButton) -// .addContainerGap()); //); -// buttonPanelLayout.setVerticalGroup( -// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) -// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup() -// .addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) -// .addComponent(saveButton) -// .addComponent(cancelButton)) -// .addContainerGap())); + // + // GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + // mainPanel.setLayout(mainPanelLayout); + // + // mainPanelLayout.setHorizontalGroup( + // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + // .addGroup(mainPanelLayout.createSequentialGroup() + // .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + // .addComponent(refIdLabel) + // .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)) + // .addContainerGap())); + // + // mainPanelLayout.setVerticalGroup( + // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + // .addGroup(mainPanelLayout.createSequentialGroup() + // .addComponent(refIdLabel) + // .addGap(refIdLabel.getFont().getSize()) + // .addComponent(hashDataScrollPane) + // .addGap(refIdLabel.getFont().getSize()))); - - backButton.setActionCommand(cancelCommand); - backButton.addActionListener(cancelListener); - saveButton.setActionCommand(saveCommand); - saveButton.addActionListener(saveListener); - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - -// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton); - buttonPanelLayout.setHorizontalGroup( - buttonPanelLayout.createSequentialGroup() - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) - .addContainerGap());//); - buttonPanelLayout.setVerticalGroup( - buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(saveButton) - .addComponent(backButton)); - - contentPanel.validate(); + + + + + + + + + + + // GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + // buttonPanel.setLayout(buttonPanelLayout); + // + // buttonPanelLayout.setHorizontalGroup( + // buttonPanelLayout.createSequentialGroup() + //// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + //// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup() + // .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + // .addComponent(saveButton) + // .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + // .addComponent(cancelButton) + // .addContainerGap()); //); + // buttonPanelLayout.setVerticalGroup( + // buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + // .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup() + // .addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + // .addComponent(saveButton) + // .addComponent(cancelButton)) + // .addContainerGap())); + + + JButton backButton = new JButton(); + backButton.setText(messages.getString(BUTTON_BACK)); + backButton.setActionCommand(cancelCommand); + backButton.addActionListener(cancelListener); + + JButton saveButton = new JButton(); + saveButton.setText(messages.getString(BUTTON_SAVE)); + saveButton.setActionCommand(saveCommand); + saveButton.addActionListener(saveListener); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + // buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton); + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) + .addContainerGap());//); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(saveButton) + .addComponent(backButton)); + + contentPanel.validate(); + } + }); } - private void showSaveHashDataInputDialog(HashDataInput signedRef, ActionListener okListener, String okCommand) { - String dir = System.getProperty("user.home"); - JFileChooser fileDialog = new JFileChooser(dir); - fileDialog.setFileSelectionMode(JFileChooser.FILES_ONLY); - fileDialog.setMultiSelectionEnabled(false); - fileDialog.setDialogTitle(messages.getString(WINDOWTITLE_SAVE)); - fileDialog.setDialogType(JFileChooser.SAVE_DIALOG); - fileDialog.setFileHidingEnabled(true); - MimeFilter mimeFilter = new MimeFilter(signedRef.getMimeType()); - fileDialog.setFileFilter(mimeFilter); - String filename = messages.getString(SAVE_HASHDATAINPUT_PREFIX) + mimeFilter.getExtension(); - fileDialog.setSelectedFile(new File(dir, filename)); - switch (fileDialog.showSaveDialog(contentPane)) { +// private DisposableFileChooser fileDialog; + + private void showSaveHashDataInputDialog(final List signedRefs, final ActionListener okListener, final String okCommand) { + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + String userHome = System.getProperty("user.home"); + + JFileChooser fileDialog = new JFileChooser(userHome); + fileDialog.setMultiSelectionEnabled(false); + fileDialog.setDialogType(JFileChooser.SAVE_DIALOG); + fileDialog.setFileHidingEnabled(true); + if (signedRefs.size() == 1) { + fileDialog.setDialogTitle(messages.getString(WINDOWTITLE_SAVE)); + fileDialog.setFileSelectionMode(JFileChooser.FILES_ONLY); + String mimeType = signedRefs.get(0).getMimeType(); + MimeFilter mimeFilter = new MimeFilter(mimeType, messages); + fileDialog.setFileFilter(mimeFilter); + String filename = messages.getString(SAVE_HASHDATAINPUT_PREFIX) + MimeFilter.getExtension(mimeType); + fileDialog.setSelectedFile(new File(userHome, filename)); + } else { + fileDialog.setDialogTitle(messages.getString(WINDOWTITLE_SAVEDIR)); + fileDialog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + } + + //parent contentPane -> placed over applet + switch (fileDialog.showSaveDialog(fileDialog)) { case JFileChooser.APPROVE_OPTION: - File f = fileDialog.getSelectedFile(); - if (f.exists()) { -// log.debug("hashDataInput file exists, overwrite?"); - String ovrwrt = messages.getString(MESSAGE_OVERWRITE); - int overwrite = JOptionPane.showConfirmDialog(contentPane, MessageFormat.format(ovrwrt, filename), messages.getString(WINDOWTITLE_OVERWRITE), JOptionPane.OK_CANCEL_OPTION); - if (overwrite != JOptionPane.OK_OPTION) { -// log.debug("User canceled overwrite HashDataInput, returning to SignaturePin dialog"); - okListener.actionPerformed(new ActionEvent(fileDialog, ActionEvent.ACTION_PERFORMED, okCommand)); - return; - } + File f = fileDialog.getSelectedFile(); + for (HashDataInput hashDataInput : signedRefs) { + String mimeType = hashDataInput.getMimeType(); + String id = hashDataInput.getReferenceId(); + File file; + if (f.isDirectory()) { + String filename = messages.getString(SAVE_HASHDATAINPUT_PREFIX) + '_' + id + MimeFilter.getExtension(mimeType); + file = new File(f, filename); + } else { + file = f; + } + if (file.exists()) { + String ovrwrt = messages.getString(MESSAGE_OVERWRITE); + int overwrite = JOptionPane.showConfirmDialog(fileDialog, MessageFormat.format(ovrwrt, file), messages.getString(WINDOWTITLE_OVERWRITE), JOptionPane.OK_CANCEL_OPTION); + if (overwrite != JOptionPane.OK_OPTION) { + continue; + } } if (log.isDebugEnabled()) { - log.debug("Writing HashDataInput " + signedRef.getReferenceId() + " (" + signedRef.getMimeType() + ") to file " + f); + log.debug("Writing HashDataInput " + id + " (" + mimeType + ") to file " + file); } FileOutputStream fos = null; try { - fos = new FileOutputStream(f); + fos = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(fos); - InputStream hdi = signedRef.getHashDataInput(); + InputStream hdi = hashDataInput.getHashDataInput(); int b; while ((b = hdi.read()) != -1) { bos.write(b); @@ -1134,7 +1200,7 @@ public class BKUGUI implements BKUGUIFacade { bos.flush(); bos.close(); } catch (IOException ex) { - log.error("Failed to write HashDataInput to file " + f + ": " + ex.getMessage()); + log.error("Failed to write HashDataInput to file " + file + ": " + ex.getMessage()); showErrorDialog("Failed to write signed reference to file: " + ex.getMessage(), null, null); ex.printStackTrace(); } finally { @@ -1142,11 +1208,15 @@ public class BKUGUI implements BKUGUIFacade { fos.close(); } catch (IOException ex) { } - } + } + } + } + log.debug("done saving hashdatainput"); + okListener.actionPerformed(new ActionEvent(fileDialog, ActionEvent.ACTION_PERFORMED, okCommand)); } - okListener.actionPerformed(new ActionEvent(fileDialog, ActionEvent.ACTION_PERFORMED, okCommand)); + }); } - + @Override public void showWaitDialog(final String waitMessage) { SwingUtilities.invokeLater(new Runnable() { @@ -1190,149 +1260,4 @@ public class BKUGUI implements BKUGUIFacade { return null; } - class PINDocument extends PlainDocument { - - private PINSpec pinSpec; - private Pattern pinPattern; - private JButton enterButton; - - public PINDocument(PINSpec pinSpec, JButton enterButton) { - this.pinSpec = pinSpec; - if (pinSpec.getRexepPattern() != null) { - pinPattern = Pattern.compile(pinSpec.getRexepPattern()); - } else { - pinPattern = Pattern.compile("."); - } - this.enterButton = enterButton; - } - - @Override - public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { - if (pinSpec.getMaxLength() >= (getLength() + str.length())) { - boolean matches = true; - for (int i = 0; i < str.length(); i++) { - Matcher m = pinPattern.matcher(str.substring(i, i + 1)); - if (!m.matches()) { - matches = false; - } - } - if (matches) { - super.insertString(offs, str, a); - } - } - enterButton.setEnabled(getLength() >= pinSpec.getMinLength()); - } - - @Override - public void remove(int offs, int len) throws BadLocationException { - super.remove(offs, len); - enterButton.setEnabled(getLength() >= pinSpec.getMinLength()); - } - } - - class MimeFilter extends FileFilter { - - protected String mimeType; - - public MimeFilter(String mimeType) { - this.mimeType = mimeType; - } - - @Override - public boolean accept(File f) { - - if (f.isDirectory()) { - return true; - } - - String ext = getExtension(f); - if ("text/xml".equals(mimeType)) { - return "xml".equalsIgnoreCase(ext); - } else if ("text/html".equals(mimeType)) { - return "html".equalsIgnoreCase(ext) || "htm".equalsIgnoreCase(ext); - } else if ("application/xhtml+xml".equals(mimeType)) { - return "xhtml".equalsIgnoreCase(ext); - } else if ("text/plain".equals(mimeType)) { - return "txt".equalsIgnoreCase(ext); - } else if ("application/pdf".equals(mimeType)) { - return "pdf".equalsIgnoreCase(ext); - } else { - return true; - } - } - - private String getExtension(File f) { - String ext = null; - String s = f.getName(); - int i = s.lastIndexOf('.'); - - if (i > 0 && i < s.length() - 1) { - ext = s.substring(i + 1).toLowerCase(); - } - return ext; - } - - @Override - public String getDescription() { - if ("text/xml".equals(mimeType)) { - return messages.getString(MIMETYPE_DESC_XML); - } else if ("text/html".equals(mimeType)) { - return messages.getString(MIMETYPE_DESC_HTML); - } else if ("application/xhtml+xml".equals(mimeType)) { - return messages.getString(MIMETYPE_DESC_XHTML); - } else if ("text/plain".equals(mimeType)) { - return messages.getString(MIMETYPE_DESC_TXT); - } else if ("application/pdf".equals(mimeType)) { - return messages.getString(MIMETYPE_DESC_PDF); - } else { - return messages.getString(MIMETYPE_DESC_BIN); - } - } - - public String getExtension() { - if ("text/xml".equals(mimeType)) { - return ".xml"; - } else if ("text/html".equals(mimeType)) { - return ".html"; - } else if ("application/xhtml+xml".equals(mimeType)) { - return ".xhtml"; - } else if ("text/plain".equals(mimeType)) { - return ".txt"; - } else if ("application/pdf".equals(mimeType)) { - return ".pdf"; - } else { - return ".bin"; - } - } - } - - class HashDataTableModel extends DefaultTableModel { - - Class[] types = new Class[]{ - java.lang.String.class, java.lang.Boolean.class - }; - - public HashDataTableModel(List signedReferences) { - super(0, 2); - for (HashDataInput hashDataInput : signedReferences) { - addRow(new Object[]{hashDataInput.getReferenceId(), new Boolean(true)}); - } - } - - @Override - public Class getColumnClass(int columnIndex) { - return types [columnIndex]; - } - - public List getSelectedReferenceIds() { - ArrayList selection = new ArrayList(); - for (Object row : dataVector) { - if ((Boolean) ((Vector) row).elementAt(1)) { - selection.add((String) ((Vector) row).elementAt(0)); - } - } - return selection; - } - - } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index f8b80556..f4b6325d 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -53,6 +53,8 @@ public interface BKUGUIFacade { public void showHashDataInputDialog(List signedReferences, ActionListener okListener, String actionCommand); +// public void showPlainTextHashDataInputDialog(String text, ActionListener saveListener, String saveCommand, ActionListener cancelListener, String cancelCommand); + public void showErrorDialog(String errorMsg, ActionListener okListener, String actionCommand); public void showErrorDialog(String errorMsg); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java new file mode 100644 index 00000000..061a2849 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java @@ -0,0 +1,71 @@ +/* +* Copyright 2008 Federal Chancellery Austria and +* Graz University of Technology +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +package at.gv.egiz.bku.gui; + +import at.gv.egiz.stal.HashDataInput; +import java.util.ArrayList; +import java.util.List; +import java.util.Vector; +import javax.swing.table.DefaultTableModel; + +/** + * + * @author clemens + */ +class HashDataTableModel extends DefaultTableModel { + + protected List signedReferences; + + Class[] types = new Class[]{ + java.lang.String.class, java.lang.Boolean.class + }; + + public HashDataTableModel(List signedReferences) { + super(0, 2); + this.signedReferences = signedReferences; + for (HashDataInput hashDataInput : signedReferences) { + String desc = hashDataInput.getReferenceId() + " (" + hashDataInput.getMimeType() + ")"; + addRow(new Object[]{desc, new Boolean(true)}); + } + } + + @Override + public Class getColumnClass(int columnIndex) { + return types [columnIndex]; + } + + public List getSelectedHashData() { + ArrayList selection = new ArrayList(); + for (int i = 0; i < dataVector.size(); i++) { + if ((Boolean) ((Vector) dataVector.get(i)).elementAt(1)) { + selection.add(signedReferences.get(i)); + } + } + return selection; + } + +// public List getSelectedReferenceIds() { +// ArrayList selection = new ArrayList(); +// for (Object row : dataVector) { +// if ((Boolean) ((Vector) row).elementAt(1)) { +// selection.add((String) ((Vector) row).elementAt(0)); +// } +// } +// return selection; +// } + + } \ No newline at end of file diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/MimeFilter.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/MimeFilter.java new file mode 100644 index 00000000..6ee61a82 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/MimeFilter.java @@ -0,0 +1,98 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package at.gv.egiz.bku.gui; + +import java.io.File; +import java.util.ResourceBundle; +import javax.swing.filechooser.FileFilter; + +/** + * + * @author clemens + */ +class MimeFilter extends FileFilter { + + private static final String MIMETYPE_DESC_XML = "mimetype.desc.xml"; + private static final String MIMETYPE_DESC_HTML = "mimetype.desc.html"; + private static final String MIMETYPE_DESC_XHTML = "mimetype.desc.xhtml"; + private static final String MIMETYPE_DESC_TXT = "mimetype.desc.txt"; + private static final String MIMETYPE_DESC_PDF = "mimetype.desc.pdf"; + private static final String MIMETYPE_DESC_BIN = "mimetype.desc.bin"; + + protected String mimeType; + protected ResourceBundle messages; + + public MimeFilter(String mimeType, ResourceBundle messages) { + this.mimeType = mimeType; + this.messages = messages; + } + + @Override + public boolean accept(File f) { + + if (f.isDirectory()) { + return true; + } + + String ext = getExtension(f); + if ("text/xml".equals(mimeType)) { + return "xml".equalsIgnoreCase(ext); + } else if ("text/html".equals(mimeType)) { + return "html".equalsIgnoreCase(ext) || "htm".equalsIgnoreCase(ext); + } else if ("application/xhtml+xml".equals(mimeType)) { + return "xhtml".equalsIgnoreCase(ext); + } else if ("text/plain".equals(mimeType)) { + return "txt".equalsIgnoreCase(ext); + } else if ("application/pdf".equals(mimeType)) { + return "pdf".equalsIgnoreCase(ext); + } else { + return true; + } + } + + private String getExtension(File f) { + String ext = null; + String s = f.getName(); + int i = s.lastIndexOf('.'); + + if (i > 0 && i < s.length() - 1) { + ext = s.substring(i + 1).toLowerCase(); + } + return ext; + } + + @Override + public String getDescription() { + if ("text/xml".equals(mimeType)) { + return messages.getString(MIMETYPE_DESC_XML); + } else if ("text/html".equals(mimeType)) { + return messages.getString(MIMETYPE_DESC_HTML); + } else if ("application/xhtml+xml".equals(mimeType)) { + return messages.getString(MIMETYPE_DESC_XHTML); + } else if ("text/plain".equals(mimeType)) { + return messages.getString(MIMETYPE_DESC_TXT); + } else if ("application/pdf".equals(mimeType)) { + return messages.getString(MIMETYPE_DESC_PDF); + } else { + return messages.getString(MIMETYPE_DESC_BIN); + } + } + + public static String getExtension(String mimeType) { + if ("text/xml".equals(mimeType)) { + return ".xml"; + } else if ("text/html".equals(mimeType)) { + return ".html"; + } else if ("application/xhtml+xml".equals(mimeType)) { + return ".xhtml"; + } else if ("text/plain".equals(mimeType)) { + return ".txt"; + } else if ("application/pdf".equals(mimeType)) { + return ".pdf"; + } else { + return ".bin"; + } + } +} \ No newline at end of file diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java new file mode 100644 index 00000000..e8572742 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java @@ -0,0 +1,58 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.bku.gui; + +import at.gv.egiz.smcc.PINSpec; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.swing.JButton; +import javax.swing.text.AttributeSet; +import javax.swing.text.BadLocationException; +import javax.swing.text.PlainDocument; + +/** + * + * @author clemens + */ +class PINDocument extends PlainDocument { + + private PINSpec pinSpec; + private Pattern pinPattern; + private JButton enterButton; + + public PINDocument(PINSpec pinSpec, JButton enterButton) { + this.pinSpec = pinSpec; + if (pinSpec.getRexepPattern() != null) { + pinPattern = Pattern.compile(pinSpec.getRexepPattern()); + } else { + pinPattern = Pattern.compile("."); + } + this.enterButton = enterButton; + } + + @Override + public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { + if (pinSpec.getMaxLength() >= (getLength() + str.length())) { + boolean matches = true; + for (int i = 0; i < str.length(); i++) { + Matcher m = pinPattern.matcher(str.substring(i, i + 1)); + if (!m.matches()) { + matches = false; + } + } + if (matches) { + super.insertString(offs, str, a); + } + } + enterButton.setEnabled(getLength() >= pinSpec.getMinLength()); + } + + @Override + public void remove(int offs, int len) throws BadLocationException { + super.remove(offs, len); + enterButton.setEnabled(getLength() >= pinSpec.getMinLength()); + } + } \ No newline at end of file diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index b651fa8d..a329ba86 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -23,6 +23,7 @@ title.retry=Falscher PIN title.wait=Bitte warten title.hashdata=Signaturdaten windowtitle.save=Signaturdaten speichern +windowtitle.savedir=Signaturdaten in Verzeichnis speichern windowtitle.overwrite=Datei \u00FCberschreiben? message.wait=Bitte warten... message.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken @@ -34,16 +35,16 @@ message.retries=Noch {0} Versuche message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben? label.pin={0}: label.pinsize=({0} stellig) -error.hashdata=Keine Signaturdaten verf\u00FCgbar +error.no.hashdata=Keine Signaturdaten verf\u00FCgbar button.ok=OK button.cancel=Abbrechen button.back=Zur\u00FCck button.sign=Signieren button.save=Speichern... -mimetype.desc.xml=XML-Dateien (*.xml) -mimetype.desc.html=HTML-Dateien (*.html, *.htm) -mimetype.desc.xhtml=XHTML-Dateien (*.xhtml) -mimetype.desc.txt=Textdateien (*.txt) -mimetype.desc.pdf=Adobe PDF-Dateien (*.pdf) -mimetype.desc.bin=Bin\u00E4rdateien (*.bin) +mimetype.desc.xml=XML-Dateien (.xml) +mimetype.desc.html=HTML-Dateien (.html, .htm) +mimetype.desc.xhtml=XHTML-Dateien (.xhtml) +mimetype.desc.txt=Textdateien (.txt) +mimetype.desc.pdf=Adobe PDF-Dateien (.pdf) +mimetype.desc.bin=Bin\u00E4rdateien (.bin) save.hashdatainput.prefix=Signaturdaten diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java index 4367f642..85f05435 100644 --- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java +++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java @@ -1,19 +1,19 @@ /* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ /* * To change this template, choose Tools | Templates * and open the template in the editor. @@ -35,137 +35,137 @@ import java.util.List; */ public class BKUGUIWorker implements Runnable { - BKUGUIFacade gui; + BKUGUIFacade gui; - public void init(BKUGUIFacade gui) { - this.gui = gui; - } + public void init(BKUGUIFacade gui) { + this.gui = gui; + } - @Override - public void run() { + @Override + public void run() { // try { - final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN"); - - - final ActionListener cancelListener = new ActionListener() { - - public void actionPerformed(ActionEvent e) { - System.out.println("CANCEL EVENT OCCURED: " + e); - } - }; - ActionListener okListener = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - System.out.println("OK EVENT OCCURED: " + e); - } - }; - final ActionListener signListener = new ActionListener() { - - public void actionPerformed(ActionEvent e) { - System.out.println("SIGN EVENT OCCURED: " + e); - } - }; - ActionListener hashdataListener = new ActionListener() { - - public void actionPerformed(ActionEvent e) { - System.out.println("HASHDATA EVENT OCCURED: " + e); - ActionListener returnListener = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", null, "hashdata"); - } - }; - HashDataInput signedRef1 = new HashDataInput() { - - @Override - public InputStream getHashDataInput() { - return new ByteArrayInputStream("HashDataInput_001\n12345\n\tHello, world!\n12345\n\n12345\n6789\nblabla".getBytes()); - } - - @Override - public String getMimeType() { - return "text/plain"; - } - - @Override - public String getReferenceId() { - return "Reference-ref1-00000000000000000000001"; - } - }; - HashDataInput signedRef2 = new HashDataInput() { - - @Override - public InputStream getHashDataInput() { - return new ByteArrayInputStream("HashDataInput_002".getBytes()); - } - - @Override - public String getMimeType() { - return "text/xml"; - } - - @Override - public String getReferenceId() { - return "Reference-ref2-00000000000000000000002"; - } - }; - HashDataInput signedRef3 = new HashDataInput() { - - @Override - public InputStream getHashDataInput() { - return new ByteArrayInputStream("HashDataInput_003".getBytes()); - } - - @Override - public String getMimeType() { - return "text/xml"; - } - - @Override - public String getReferenceId() { - return "Reference-ref3-00000000000000000000003"; - } - }; - HashDataInput signedRef4 = new HashDataInput() { - - @Override - public InputStream getHashDataInput() { - return new ByteArrayInputStream("HashDataInput_004".getBytes()); - } - - @Override - public String getMimeType() { - return "text/xml"; - } - - @Override - public String getReferenceId() { - return "ref4"; - } - }; - - // - List signedRefs = new ArrayList(); - signedRefs.add(signedRef1); + final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN"); + + + final ActionListener cancelListener = new ActionListener() { + + public void actionPerformed(ActionEvent e) { + System.out.println("CANCEL EVENT OCCURED: " + e); + } + }; + ActionListener okListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + System.out.println("OK EVENT OCCURED: " + e); + } + }; + final ActionListener signListener = new ActionListener() { + + public void actionPerformed(ActionEvent e) { + System.out.println("SIGN EVENT OCCURED: " + e); + } + }; + ActionListener hashdataListener = new ActionListener() { + + public void actionPerformed(ActionEvent e) { + System.out.println("HASHDATA EVENT OCCURED: " + e); + ActionListener returnListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", null, "hashdata"); + } + }; + HashDataInput signedRef1 = new HashDataInput() { + + @Override + public InputStream getHashDataInput() { + return new ByteArrayInputStream("oialfx HashDataInput_001\n12345\n\tHello, world!\n12345\n\n12345\n6789\nblabla".getBytes()); + } + + @Override + public String getMimeType() { + return "text/plain"; + } + + @Override + public String getReferenceId() { + return "Reference-ref1-00000000000000000000001"; + } + }; + HashDataInput signedRef2 = new HashDataInput() { + + @Override + public InputStream getHashDataInput() { + return new ByteArrayInputStream("HashDataInput_002".getBytes()); + } + + @Override + public String getMimeType() { + return "text/xml"; + } + + @Override + public String getReferenceId() { + return "Reference-ref2-00000000000000000000002"; + } + }; + HashDataInput signedRef3 = new HashDataInput() { + + @Override + public InputStream getHashDataInput() { + return new ByteArrayInputStream("HashDataInput_003".getBytes()); + } + + @Override + public String getMimeType() { + return "text/xml"; + } + + @Override + public String getReferenceId() { + return "Reference-ref3-00000000000000000000003"; + } + }; + HashDataInput signedRef4 = new HashDataInput() { + + @Override + public InputStream getHashDataInput() { + return new ByteArrayInputStream("HashDataInput_004".getBytes()); + } + + @Override + public String getMimeType() { + return "text/xml"; + } + + @Override + public String getReferenceId() { + return "ref4"; + } + }; + + // + List signedRefs = new ArrayList(); + signedRefs.add(signedRef1); signedRefs.add(signedRef2); signedRefs.add(signedRef3); signedRefs.add(signedRef4); // signedRefs = Collections.singletonList(signedRef1); - gui.showHashDataInputDialog(signedRefs, returnListener, "return"); - } - }; - + gui.showHashDataInputDialog(signedRefs, returnListener, "return"); + } + }; + // gui.showWelcomeDialog(); // // Thread.sleep(2000); - + // gui.showInsertCardDialog(cancelListener, "cancel"); - + // Thread.sleep(2000); // // gui.showCardNotSupportedDialog(cancelListener, "cancel"); @@ -178,11 +178,11 @@ public class BKUGUIWorker implements Runnable { // // Thread.sleep(2000); // - - gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); + + gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); // Thread.sleep(2000); - + // gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); // // Thread.sleep(2000); @@ -192,13 +192,13 @@ public class BKUGUIWorker implements Runnable { // Thread.sleep(2000); // // gui.showErrorDialog("Testfehler occured"); - - + + // gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save"); // Thread.sleep(2000); // } catch (InterruptedException ex) { // ex.printStackTrace(); // } - } + } } diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index d31367a8..a50954cd 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -58,11 +58,13 @@ 1.0-SNAPSHOT compile - + + + at.gv.egiz + BKUApplet + 1.0-SNAPSHOT + provided + @@ -177,4 +179,5 @@ +>>>>>>> .r33 diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java index 1f84300a..d37d0551 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java @@ -47,6 +47,8 @@ import at.gv.egiz.stal.signedinfo.ObjectFactory; import at.gv.egiz.stal.signedinfo.ReferenceType; import at.gv.egiz.stal.signedinfo.SignedInfoType; import at.gv.egiz.stal.util.JCEAlgorithmNames; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -150,9 +152,6 @@ public class SignRequestHandler extends AbstractRequestHandler implements hashDataInputs = getHashDataInputs(signedInfo.getReference()); } gui.showHashDataInputDialog(hashDataInputs, this, "ok"); - waitForAction(); - gui.showSignaturePINDialog(spec, this, "sign", this, "cancel", this, - "hashData"); } catch (Exception ex) { //FIXME localize messages log.error("Failed to obtain HashDataInputs: " + ex.getMessage()); @@ -178,6 +177,7 @@ public class SignRequestHandler extends AbstractRequestHandler implements /** * override by subclass + * @post-condition returned list != null * @return */ protected List getHashDataInputs(List signedReferences) throws Exception { -- cgit v1.2.3 From 0df8bb10302989f41ed420ec0ff29b2fc2005471 Mon Sep 17 00:00:00 2001 From: wbauer Date: Mon, 15 Sep 2008 14:18:53 +0000 Subject: Migrated BKULocal to BKUCommonGUI and minor bug fixes git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@37 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUWorker.java | 11 + BKULocal/pom.xml | 5 + .../at/gv/egiz/bku/local/stal/BKUGuiProxy.java | 130 ++++++++++ .../bku/local/stal/LocalSignRequestHandler.java | 84 +++++++ .../java/at/gv/egiz/bku/local/stal/PINDialog.java | 214 ----------------- .../gv/egiz/bku/local/stal/QuitRequestHandler.java | 41 ---- .../java/at/gv/egiz/bku/local/stal/SMCCSTAL.java | 100 ++------ .../at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 100 ++++++-- .../egiz/bku/local/stal/SwingInsertCardDialog.java | 147 ------------ .../gv/egiz/bku/local/stal/SwingPINProvider.java | 57 ----- .../at/gv/egiz/bku/local/stal/SwingPinDialog.java | 265 --------------------- .../gv/egiz/bku/online/webapp/ResultServlet.java | 1 + .../service/impl/RequestBrokerSTALFactory.java | 5 + .../java/at/gv/egiz/bku/slxhtml/ValidatorTest.java | 5 +- .../src/main/java/at/gv/egiz/stal/STALFactory.java | 6 +- .../bku/binding/BindingProcessorManagerImpl.java | 1 + .../gv/egiz/bku/binding/DataUrlConnectionImpl.java | 20 +- .../egiz/bku/slcommands/impl/xsect/Signature.java | 25 ++ .../at/gv/egiz/bku/binding/DummyStalFactory.java | 8 + 19 files changed, 382 insertions(+), 843 deletions(-) create mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java create mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java delete mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/stal/PINDialog.java delete mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/stal/QuitRequestHandler.java delete mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingInsertCardDialog.java delete mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingPINProvider.java delete mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingPinDialog.java (limited to 'BKUApplet') 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 51ac243c..cd96a481 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 @@ -75,6 +75,17 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, addRequestHandler(QuitRequest.class, this); //register SignRequestHandler once we have a webservice port } + + /** + * Used for non applet variants + * @param gui + * @param errorMessageBundle + */ + protected BKUWorker(BKUGUIFacade gui, ResourceBundle errorMessageBundle) { + this.gui = gui; + this.errorMessages = errorMessageBundle; + addRequestHandler(QuitRequest.class, this); + } private STALPortType getSTALPort() throws MalformedURLException { URL wsdlURL = null; diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index 3f77752a..341e574a 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -74,6 +74,11 @@ org.springframework spring-tx 2.5.5 + + + at.gv.egiz + BKUApplet + 1.0-SNAPSHOT \ No newline at end of file diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java new file mode 100644 index 00000000..0bed928d --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java @@ -0,0 +1,130 @@ +package at.gv.egiz.bku.local.stal; + +import java.awt.Container; +import java.awt.event.ActionListener; +import java.util.List; + +import javax.swing.JDialog; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.stal.HashDataInput; + +public class BKUGuiProxy implements BKUGUIFacade { + + private BKUGUIFacade delegate; + private JDialog dialog; + + public BKUGuiProxy(JDialog dialog, BKUGUIFacade delegate) { + this.delegate = delegate; + this.dialog = dialog; + } + + private void showDialog() { + dialog.setVisible(true); + dialog.setAlwaysOnTop(true); + } + + @Override + public char[] getPin() { + return delegate.getPin(); + } + + @Override + public void init(Container contentPane, String localeString) { + delegate.init(contentPane, localeString); + } + + @Override + public void showCardNotSupportedDialog(ActionListener cancelListener, + String actionCommand) { + showDialog(); + delegate.showCardNotSupportedDialog(cancelListener, actionCommand); + } + + @Override + public void showCardPINDialog(PINSpec pinSpec, ActionListener okListener, + String okCommand, ActionListener cancelListener, String cancelCommand) { + showDialog(); + delegate.showCardPINDialog(pinSpec, okListener, okCommand, cancelListener, + cancelCommand); + } + + @Override + public void showCardPINRetryDialog(PINSpec pinSpec, int numRetries, + ActionListener okListener, String okCommand, + ActionListener cancelListener, String cancelCommand) { + showDialog(); + delegate.showCardPINRetryDialog(pinSpec, numRetries, okListener, okCommand, + cancelListener, cancelCommand); + } + + @Override + public void showErrorDialog(String errorMsg, ActionListener okListener, + String actionCommand) { + showDialog(); + delegate.showErrorDialog(errorMsg, okListener, actionCommand); + } + + @Override + public void showErrorDialog(String errorMsg) { + showDialog(); + delegate.showErrorDialog(errorMsg); + } + + @Override + public void showHashDataInputDialog(List signedReferences, + ActionListener okListener, String actionCommand) { + showDialog(); + delegate.showHashDataInputDialog(signedReferences, okListener, + actionCommand); + } + + @Override + public void showInsertCardDialog(ActionListener cancelListener, + String actionCommand) { + showDialog(); + delegate.showInsertCardDialog(cancelListener, actionCommand); + } + + @Override + public void showLoginDialog(ActionListener loginListener, String actionCommand) { + showDialog(); + + delegate.showLoginDialog(loginListener, actionCommand); + } + + @Override + public void showSignaturePINDialog(PINSpec pinSpec, + ActionListener signListener, String signCommand, + ActionListener cancelListener, String cancelCommand, + ActionListener hashdataListener, String hashdataCommand) { + showDialog(); + delegate.showSignaturePINDialog(pinSpec, signListener, signCommand, + cancelListener, cancelCommand, hashdataListener, hashdataCommand); + } + + @Override + public void showSignaturePINRetryDialog(PINSpec pinSpec, int numRetries, + ActionListener okListener, String okCommand, + ActionListener cancelListener, String cancelCommand, + ActionListener hashdataListener, String hashdataCommand) { + showDialog(); + delegate.showSignaturePINRetryDialog(pinSpec, numRetries, okListener, + okCommand, cancelListener, cancelCommand, hashdataListener, + hashdataCommand); + } + + @Override + public void showWaitDialog(String waitMessage) { + showDialog(); + delegate.showWaitDialog(waitMessage); + } + + @Override + public void showWelcomeDialog() { + showDialog(); + delegate.showWelcomeDialog(); + } + +} diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java new file mode 100644 index 00000000..f8546e49 --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java @@ -0,0 +1,84 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.local.stal; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; +import at.gv.egiz.bku.smccstal.SignRequestHandler; +import at.gv.egiz.stal.HashDataInput; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.SignRequest; +import at.gv.egiz.stal.signedinfo.ReferenceType; + +/** + * + * @author clemens + */ +public class LocalSignRequestHandler extends SignRequestHandler { + + private static final Log log = LogFactory + .getLog(LocalSignRequestHandler.class); + private List hashDataInput = Collections.EMPTY_LIST; + + public LocalSignRequestHandler() { + } + + @SuppressWarnings("unchecked") + @Override + public STALResponse handleRequest(STALRequest request) { + if (request instanceof SignRequest) { + SignRequest signReq = (SignRequest) request; + hashDataInput = signReq.getHashDataInput(); + } + return super.handleRequest(request); + } + + @Override + protected List getHashDataInputs( + List dsigReferences) throws Exception { + ArrayList result = new ArrayList(); + for (ReferenceType dsigRef : dsigReferences) { + // don't get Manifest, QualifyingProperties, ... + if (dsigRef.getType() == null) { + String dsigRefId = dsigRef.getId(); + if (dsigRefId != null) { + for (HashDataInput hdi : hashDataInput) { + if (hdi.getReferenceId().equals(dsigRefId)) { + result.add(hdi); + } + } + } else { + throw new Exception( + "Cannot get HashDataInput for dsig:Reference without Id attribute"); + } + } + } + return result; + } + + @Override + public SMCCSTALRequestHandler newInstance() { + return new LocalSignRequestHandler(); + } +} diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/PINDialog.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/PINDialog.java deleted file mode 100644 index 5bc6bab5..00000000 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/PINDialog.java +++ /dev/null @@ -1,214 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.bku.local.stal; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.swing.JButton; -import javax.swing.JPasswordField; -import javax.swing.text.AttributeSet; -import javax.swing.text.BadLocationException; -import javax.swing.text.PlainDocument; - -import at.gv.egiz.smcc.PINSpec; - -public class PINDialog extends javax.swing.JDialog implements ActionListener { - - // Variables declaration - do not modify - private javax.swing.JButton okButton; - private javax.swing.JButton cancelButton; - private javax.swing.JLabel label; - private javax.swing.JPasswordField password; - // End of variables declaration - - private PINSpec pinSpec; - private String pinString; - private boolean finished = false; - - class PinDocument extends PlainDocument { - private Pattern pattern; - - public PinDocument() { - pattern = Pattern.compile(pinSpec.getRexepPattern()); - } - - public void insertString(int offs, String str, AttributeSet a) - throws BadLocationException { - if (pinSpec.getMaxLength() >= (getLength() + str.length())) { - Matcher matcher = pattern.matcher(str); - if (matcher.matches()) { - super.insertString(offs, str, a); - } - } - okButton.setEnabled(getLength() >= pinSpec.getMinLength()); - } - - @Override - public void remove(int offs, int len) throws BadLocationException { - super.remove(offs, len); - okButton.setEnabled(getLength() >= pinSpec.getMinLength()); - } - } - - public PINDialog() { - } - - private synchronized void finished(boolean ok) { - if (ok) { - pinString = password.getText(); - } else { - pinString = null; - } - finished = true; - notifyAll(); - } - - public synchronized void waitFinished() { - while (!finished) { - try { - wait(); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - public String getPIN() { - return pinString; - } - - /** Creates new form NewJDialog */ - public PINDialog(java.awt.Frame parent, boolean modal, PINSpec pinSpec, - int retries) { - super(parent, modal); - this.pinSpec = pinSpec; - initComponents(); - } - - private void initComponents() { - okButton = new javax.swing.JButton(); - cancelButton = new javax.swing.JButton(); - password = new javax.swing.JPasswordField(); - label = new javax.swing.JLabel(); - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - - setTitle("PIN Dialog"); // NOI18N - setName("Form"); // NOI18N - - okButton.setText("OK"); // NOI18N - okButton.setName("okButton"); // NOI18N - okButton.setEnabled(false); - okButton.addActionListener(this); - - cancelButton.setText("Cancel"); // NOI18N - cancelButton.setName("cancelButton"); // NOI18N - cancelButton.addActionListener(this); - - password.setText(""); // NOI18N - password.setName("password"); // NOI18N - password.addActionListener(this); - password.setDocument(new PinDocument()); - - label.setText("PIN: "); // NOI18N - label.setName("jLabel1"); // NOI18N - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout( - getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup(layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING).addGroup( - layout.createSequentialGroup().addContainerGap().addGroup( - layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING).addGroup( - layout.createSequentialGroup().addComponent(label, - javax.swing.GroupLayout.PREFERRED_SIZE, 61, - javax.swing.GroupLayout.PREFERRED_SIZE).addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED, - javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(password, - javax.swing.GroupLayout.PREFERRED_SIZE, 127, - javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup( - javax.swing.GroupLayout.Alignment.TRAILING, - layout.createSequentialGroup().addComponent(cancelButton) - .addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(okButton))).addContainerGap())); - layout.setVerticalGroup(layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING).addGroup( - layout.createSequentialGroup().addContainerGap().addGroup( - layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.BASELINE).addComponent(label, - javax.swing.GroupLayout.PREFERRED_SIZE, 33, - javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(password, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE)).addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED, 14, - Short.MAX_VALUE).addGroup( - layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.BASELINE).addComponent( - okButton).addComponent(cancelButton)).addContainerGap())); - - pack(); - } - - /** - * @param args - * the command line arguments - */ - public static void main(String args[]) { - java.awt.EventQueue.invokeLater(new Runnable() { - public void run() { - PINDialog dialog = new PINDialog(new javax.swing.JFrame(), true, - new PINSpec(1, 5, "[0-9]*", "Hansi"), 10); - dialog.setResizable(false); - dialog.addWindowListener(new java.awt.event.WindowAdapter() { - public void windowClosing(java.awt.event.WindowEvent e) { - System.exit(0); - } - }); - dialog.setVisible(true); - } - }); - } - - @Override - public void actionPerformed(ActionEvent e) { - if (e.getSource() instanceof JButton) { - JButton pressed = (JButton) e.getSource(); - if (pressed.getName().equals("okButton")) { - finished(true); - } else if (pressed.getName().equals("cancelButton")) { - finished(false); - } - } else if (e.getSource() instanceof JPasswordField) { - JPasswordField pwf = (JPasswordField) e.getSource(); - if (pwf.getName().equals("password")) { - if (password.getPassword().length >= pinSpec.getMinLength()) { - finished(true); - } - } - } - } - -} diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/QuitRequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/QuitRequestHandler.java deleted file mode 100644 index 5596b7bb..00000000 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/QuitRequestHandler.java +++ /dev/null @@ -1,41 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.bku.local.stal; - -import at.gv.egiz.bku.smccstal.AbstractRequestHandler; -import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; -import at.gv.egiz.stal.STALRequest; -import at.gv.egiz.stal.STALResponse; - -public class QuitRequestHandler extends AbstractRequestHandler { - - @Override - public STALResponse handleRequest(STALRequest request) { - return null; - } - - @Override - public boolean requireCard() { - return false; - } - - @Override - public SMCCSTALRequestHandler newInstance() { - return this; - } - -} diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java index 26ec2aa8..6f9e72c5 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java @@ -1,95 +1,33 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ package at.gv.egiz.bku.local.stal; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Locale; +import java.util.List; +import java.util.ResourceBundle; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import javax.swing.JDialog; import at.gv.egiz.bku.gui.BKUGUIFacade; -import at.gv.egiz.bku.local.ui.TrayIconDialog; -import at.gv.egiz.bku.smccstal.AbstractRequestHandler; -import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; -import at.gv.egiz.bku.smccstal.STALMessageConsumer; -import at.gv.egiz.smcc.PINProvider; -import at.gv.egiz.smcc.util.SMCCHelper; -import at.gv.egiz.stal.QuitRequest; +import at.gv.egiz.bku.online.applet.BKUWorker; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.SignRequest; -public class SMCCSTAL extends AbstractSMCCSTAL implements STALMessageConsumer { - private static Log log = LogFactory.getLog(SMCCSTAL.class); +public class SMCCSTAL extends BKUWorker { - protected PINProvider pinProvider = new SwingPINProvider(); - protected SwingInsertCardDialog insertCard = new SwingInsertCardDialog(); - private boolean canceled = false; + private JDialog container; - static { - addRequestHandler(QuitRequest.class, new QuitRequestHandler()); - } - - public SMCCSTAL() { - AbstractRequestHandler.setMessageConsumer(this); - } - - /** - * - * @return if the user canceled - */ - protected boolean waitForCard() { - canceled = false; - while ((smccHelper.getResultCode() != SMCCHelper.CARD_FOUND) && (!canceled)) { - insertCard.setVisible(true); - insertCard.setAlwaysOnTop(true); - insertCard.addCanceledListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - canceled = true; - } - }); - try { - smccHelper.update(1000); - } catch (Exception ex) { - log.info(ex); - } - } - insertCard.setVisible(false); - signatureCard = smccHelper.getSignatureCard(locale); - return canceled; + public SMCCSTAL(BKUGUIFacade gui, JDialog container, + ResourceBundle errorMessageBundle) { + super(gui, errorMessageBundle); + this.container = container; + addRequestHandler(SignRequest.class, new LocalSignRequestHandler()); } @Override - public void setLocale(Locale locale) { - super.setLocale(locale); - if (pinProvider instanceof SwingPINProvider) { - ((SwingPINProvider) pinProvider).setLocale(locale); - } + public List handleRequest(List requestList) { + signatureCard = null; + List responses = super.handleRequest(requestList); + container.setVisible(false); + return responses; } - @Override - public void consumeNewSTALMessage(String captionId, String messageId) { - TrayIconDialog.getInstance().displayInfo(captionId, messageId); - } - - @Override - protected BKUGUIFacade getGUI() { - // TODO Auto-generated method stub - //FIXME - return null; - } } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java index 014d884a..97646d09 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java @@ -1,27 +1,75 @@ /* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.bku.local.stal; - -import at.gv.egiz.stal.STAL; -import at.gv.egiz.stal.STALFactory; - -public class SMCCSTALFactory implements STALFactory { - @Override - public STAL createSTAL() { - return new SMCCSTAL(); - } -} + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.local.stal; + +import java.awt.Dimension; +import java.awt.Toolkit; +import java.util.Locale; +import java.util.ResourceBundle; + +import javax.swing.JDialog; +import javax.swing.WindowConstants; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.bku.gui.BKUGUIFactory; +import at.gv.egiz.bku.online.applet.BKUApplet; +import at.gv.egiz.stal.STAL; +import at.gv.egiz.stal.STALFactory; + +public class SMCCSTALFactory implements STALFactory { + + private Locale locale; + private SMCCSTAL stal; + private JDialog dialog; + + @Override + public STAL createSTAL() { + if (stal == null) { + ResourceBundle resourceBundle; + if (locale != null) { + resourceBundle = ResourceBundle.getBundle( + BKUApplet.RESOURCE_BUNDLE_BASE, locale); + } else { + resourceBundle = ResourceBundle + .getBundle(BKUApplet.RESOURCE_BUNDLE_BASE); + } + dialog = new JDialog(); + BKUGUIFacade gui = BKUGUIFactory.createGUI(); + gui.init(dialog.getContentPane(), locale.toString()); + stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog, resourceBundle); + dialog.setPreferredSize(new Dimension(400, 200)); + dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + Dimension frameSize = dialog.getSize(); + if (frameSize.height > screenSize.height) { + frameSize.height = screenSize.height; + } + if (frameSize.width > screenSize.width) { + frameSize.width = screenSize.width; + } + dialog.setLocation((screenSize.width - frameSize.width) / 2, + (screenSize.height - frameSize.height) / 2); + dialog.pack(); + } + return stal; + } + + @Override + public void setLocale(Locale locale) { + this.locale = locale; + } +} diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingInsertCardDialog.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingInsertCardDialog.java deleted file mode 100644 index eb76f2f2..00000000 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingInsertCardDialog.java +++ /dev/null @@ -1,147 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.bku.local.stal; - -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Toolkit; -import java.awt.event.ActionListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.Locale; -import java.util.ResourceBundle; - -import javax.swing.ImageIcon; -import javax.swing.JDialog; - -import at.gv.egiz.bku.utils.StreamUtil; - -public class SwingInsertCardDialog extends JDialog { - - private javax.swing.JButton cancelButton; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel2; - private Locale locale = Locale.getDefault(); - - public SwingInsertCardDialog() { - super((java.awt.Frame) null, false); - initComponents(); - } - - public void setLocale(Locale locale) { - this.locale = locale; - } - - private void initComponents() { - ResourceBundle rb = ResourceBundle.getBundle( - "at/gv/egiz/bku/local/Userdialog", locale); - setTitle(rb.getString("Insert.Header")); - jLabel1 = new javax.swing.JLabel(); - jLabel2 = new javax.swing.JLabel(); - cancelButton = new javax.swing.JButton(); - - setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); - setName("Form"); // NOI18N - setUndecorated(true); - - jLabel1.setFont(new Font("Tahoma", Font.BOLD, 14)); - jLabel1.setText(rb.getString("Insert.Text")); // NOI18N - jLabel1.setName("text"); // NOI18N - - ByteArrayOutputStream os = new ByteArrayOutputStream(); - InputStream is = getClass().getClassLoader().getResourceAsStream( - "at/gv/egiz/bku/local/logo.png"); - try { - StreamUtil.copyStream(is, os); - jLabel2.setIcon(new ImageIcon(os.toByteArray())); // NOI18N - } catch (IOException e) { - jLabel2.setText("Chipperling image missing"); // NOI18N - } - jLabel2.setName("jLabel2"); // NOI18N - cancelButton.setText(rb.getString("Insert.Button.Cancel")); // NOI18N - cancelButton.setName("jButton1"); // NOI18N - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout( - getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup(layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING).addGroup( - layout.createSequentialGroup().addContainerGap().addComponent(jLabel2) - .addGroup( - layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.TRAILING).addGroup( - layout.createSequentialGroup().addGap(35, 35, 35) - .addComponent(jLabel1, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - Short.MAX_VALUE)).addGroup( - layout.createSequentialGroup().addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cancelButton))).addGap(29, 29, 29))); - layout.setVerticalGroup(layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING).addGroup( - javax.swing.GroupLayout.Alignment.TRAILING, - layout.createSequentialGroup().addContainerGap().addGroup( - layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.TRAILING).addComponent( - jLabel2).addGroup( - layout.createSequentialGroup().addComponent(jLabel1, - javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE) - .addGap(35, 35, 35).addComponent(cancelButton).addGap(9, 9, - 9))).addContainerGap())); - - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - Dimension frameSize = getSize(); - if (frameSize.height > screenSize.height) { - frameSize.height = screenSize.height; - } - if (frameSize.width > screenSize.width) { - frameSize.width = screenSize.width; - } - setLocation((screenSize.width - frameSize.width) / 2, - (screenSize.height - frameSize.height) / 2); - setUndecorated(false); - pack(); - } - - public void addCanceledListener(ActionListener al) { - cancelButton.addActionListener(al); - } - - /** - * @param args - * the command line arguments - */ - public static void main(String args[]) { - java.awt.EventQueue.invokeLater(new Runnable() { - public void run() { - SwingInsertCardDialog dialog = new SwingInsertCardDialog(); - dialog.addWindowListener(new java.awt.event.WindowAdapter() { - public void windowClosing(java.awt.event.WindowEvent e) { - System.exit(0); - } - }); - // - } - }); - } - -} diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingPINProvider.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingPINProvider.java deleted file mode 100644 index 7d36e68e..00000000 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingPINProvider.java +++ /dev/null @@ -1,57 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.bku.local.stal; - -import java.util.Locale; - -import at.gv.egiz.smcc.PINProvider; -import at.gv.egiz.smcc.PINSpec; - -public class SwingPINProvider implements PINProvider { - - private Locale locale = Locale.getDefault(); - SwingPinDialog dialog; - - public SwingPINProvider() { - this.locale = Locale.getDefault(); - - } - - public Locale getLocale() { - return locale; - } - - public void setLocale(Locale locale) { - this.locale = locale; - } - - @Override - public String providePIN(PINSpec pinSpec, int retries) { - dialog = new SwingPinDialog(null, false); - dialog.setResizable(false); - dialog.setRetries(retries); - dialog.setPinSpec(pinSpec); - dialog.initComponents(); - dialog.setVisible(true); - dialog.requestFocus(); - dialog.setAlwaysOnTop(true); - dialog.waitFinished(); - dialog.dispose(); - return dialog.getPIN(); - } - -} diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingPinDialog.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingPinDialog.java deleted file mode 100644 index 3e91972c..00000000 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SwingPinDialog.java +++ /dev/null @@ -1,265 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.bku.local.stal; - -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.text.MessageFormat; -import java.util.Locale; -import java.util.ResourceBundle; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JPasswordField; -import javax.swing.text.AttributeSet; -import javax.swing.text.BadLocationException; -import javax.swing.text.PlainDocument; - -import at.gv.egiz.bku.utils.StreamUtil; -import at.gv.egiz.smcc.PINSpec; - -public class SwingPinDialog extends javax.swing.JDialog implements - ActionListener { - - private javax.swing.JButton okButton; - private javax.swing.JButton cancelButton; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel2; - private javax.swing.JPasswordField password; - - private PINSpec pinSpec; - private String pinString; - private boolean finished = false; - private int retries = -1; - private Locale locale = Locale.getDefault(); - private boolean setUp = false; - - class PinDocument extends PlainDocument { - private Pattern pattern; - - public PinDocument() { - if ((pinSpec != null) && (pinSpec.getRexepPattern() != null)) { - pattern = Pattern.compile(pinSpec.getRexepPattern()); - } else { - pattern = Pattern.compile("."); - } - } - - public void insertString(int offs, String str, AttributeSet a) - throws BadLocationException { - if (pinSpec.getMaxLength() >= (getLength() + str.length())) { - Matcher matcher = pattern.matcher(str); - if (matcher.matches()) { - super.insertString(offs, str, a); - } - } - okButton.setEnabled(getLength() >= pinSpec.getMinLength()); - } - - @Override - public void remove(int offs, int len) throws BadLocationException { - super.remove(offs, len); - okButton.setEnabled(getLength() >= pinSpec.getMinLength()); - } - } - - /** - * Make sure to call initComponents - * - * @param parent - * @param modal - */ - public SwingPinDialog(java.awt.Frame parent, boolean modal) { - super(parent, modal); - } - - public void setLocale(Locale locale) { - this.locale = locale; - } - - public void setPinSpec(PINSpec pinSpec) { - this.pinSpec = pinSpec; - } - - public void setRetries(int retries) { - this.retries = retries; - } - - public void initComponents() { - ResourceBundle rb = ResourceBundle.getBundle( - "at/gv/egiz/bku/local/Userdialog", locale); - okButton = new javax.swing.JButton(); - cancelButton = new javax.swing.JButton(); - password = new javax.swing.JPasswordField(); - jLabel1 = new javax.swing.JLabel(); - jLabel2 = new javax.swing.JLabel(); - - setTitle(rb.getString("Pin.Header")); - setName("Form"); - setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); - - okButton.setText(rb.getString("Pin.Button.OK")); - okButton.setName("okButton"); - okButton.setEnabled(false); - okButton.addActionListener(this); - - cancelButton.setText(rb.getString("Pin.Button.Cancel")); - cancelButton.setName("cancelButton"); - cancelButton.addActionListener(this); - - password.setText(""); - password.setDocument(new PinDocument()); - password.setName("password"); - password.addActionListener(this); - password.setDocument(new PinDocument()); - password.setRequestFocusEnabled(true); - password.requestFocus(); - - jLabel1.setFont(new Font("Tahoma", Font.BOLD, 14)); - String text = null; - Object[] args; - if (retries > 0) { - text = rb.getString("Pin.Text.Retries"); - args = new Object[2]; - args[0] = pinSpec.getLocalizedName(); - args[1] = new Integer(retries); - } else { - text = rb.getString("Pin.Text.NoRetries"); - args = new Object[1]; - args[0] = pinSpec.getLocalizedName(); - } - text = MessageFormat.format(text, args); - jLabel1.setText(text); // NOI18N - jLabel1.setName("jLabel1"); // NOI18N - - ByteArrayOutputStream os = new ByteArrayOutputStream(); - InputStream is = getClass().getClassLoader().getResourceAsStream( - "at/gv/egiz/bku/local/logo.png"); - try { - StreamUtil.copyStream(is, os); - jLabel2.setIcon(new ImageIcon(os.toByteArray())); // NOI18N - } catch (Exception e) { - jLabel2.setText("Chipperling image missing"); // NOI18N - } - jLabel2.setName("jLabel2"); // NOI18N - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout( - getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup(layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING).addGroup( - layout.createSequentialGroup().addContainerGap().addComponent(jLabel2) - .addGap(73, 73, 73).addGroup( - layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING).addComponent( - jLabel1).addGroup( - layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent(password, - javax.swing.GroupLayout.Alignment.LEADING) - .addGroup( - javax.swing.GroupLayout.Alignment.LEADING, - layout.createSequentialGroup().addComponent( - cancelButton).addGap(18, 18, 18).addComponent( - okButton)))).addContainerGap(31, - Short.MAX_VALUE))); - layout.setVerticalGroup(layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING).addGroup( - layout.createSequentialGroup().addContainerGap().addGroup( - layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel2).addGroup( - layout.createSequentialGroup().addPreferredGap( - javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabel1, - javax.swing.GroupLayout.PREFERRED_SIZE, 33, - javax.swing.GroupLayout.PREFERRED_SIZE).addGap(18, - 18, 18).addComponent(password, - javax.swing.GroupLayout.PREFERRED_SIZE, - javax.swing.GroupLayout.DEFAULT_SIZE, - javax.swing.GroupLayout.PREFERRED_SIZE).addGap(20, - 20, 20).addGroup( - layout.createParallelGroup( - javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(cancelButton).addComponent( - okButton)))).addGap(36, 36, 36))); - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - Dimension frameSize = getSize(); - if (frameSize.height > screenSize.height) { - frameSize.height = screenSize.height; - } - if (frameSize.width > screenSize.width) { - frameSize.width = screenSize.width; - } - setLocation((screenSize.width - frameSize.width) / 2, - (screenSize.height - frameSize.height) / 2); - setUndecorated(false); - pack(); - } - - public String getPIN() { - return pinString; - } - - private synchronized void finished(boolean ok) { - if (ok) { - pinString = password.getText(); - } else { - pinString = null; - } - finished = true; - notifyAll(); - } - - public synchronized void waitFinished() { - while (!finished) { - try { - wait(); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - } - - @Override - public void actionPerformed(ActionEvent e) { - if (e.getSource() instanceof JButton) { - JButton pressed = (JButton) e.getSource(); - if (pressed.getName().equals("okButton")) { - finished(true); - } else if (pressed.getName().equals("cancelButton")) { - finished(false); - } - } else if (e.getSource() instanceof JPasswordField) { - JPasswordField pwf = (JPasswordField) e.getSource(); - if (pwf.getName().equals("password")) { - if (password.getPassword().length >= pinSpec.getMinLength()) { - finished(true); - } - } - } - } - -} diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java index 28c714c1..b70a6274 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/ResultServlet.java @@ -123,6 +123,7 @@ public class ResultServlet extends SpringBKUServlet { resp.setContentType(bp.getResultContentType()); resp.setCharacterEncoding(encoding); bp.writeResultTo(resp.getOutputStream(), encoding); + resp.getOutputStream().flush(); session.invalidate(); getBindingProcessorManager().removeBindingProcessor(bp.getId()); } diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/RequestBrokerSTALFactory.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/RequestBrokerSTALFactory.java index 38c568ab..8e61230c 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/RequestBrokerSTALFactory.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/RequestBrokerSTALFactory.java @@ -21,6 +21,8 @@ package at.gv.egiz.stal.service.impl; +import java.util.Locale; + import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.STALFactory; @@ -35,4 +37,7 @@ public class RequestBrokerSTALFactory implements STALFactory { return new STALRequestBrokerImpl(); } + @Override + public void setLocale(Locale locale) { + } } diff --git a/BKUViewer/src/test/java/at/gv/egiz/bku/slxhtml/ValidatorTest.java b/BKUViewer/src/test/java/at/gv/egiz/bku/slxhtml/ValidatorTest.java index 38c64262..4708d6e7 100644 --- a/BKUViewer/src/test/java/at/gv/egiz/bku/slxhtml/ValidatorTest.java +++ b/BKUViewer/src/test/java/at/gv/egiz/bku/slxhtml/ValidatorTest.java @@ -16,19 +16,20 @@ */ package at.gv.egiz.bku.slxhtml; -import static org.junit.Assert.*; +import static org.junit.Assert.assertNotNull; import java.io.InputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.junit.Ignore; import org.junit.Test; import at.gv.egiz.bku.viewer.ValidationException; import at.gv.egiz.bku.viewer.Validator; import at.gv.egiz.bku.viewer.ValidatorFactory; - +@Ignore public class ValidatorTest { private static Log log = LogFactory.getLog(ValidatorTest.class); diff --git a/STAL/src/main/java/at/gv/egiz/stal/STALFactory.java b/STAL/src/main/java/at/gv/egiz/stal/STALFactory.java index e7b3edd1..f9cf00c6 100644 --- a/STAL/src/main/java/at/gv/egiz/stal/STALFactory.java +++ b/STAL/src/main/java/at/gv/egiz/stal/STALFactory.java @@ -15,8 +15,10 @@ * limitations under the License. */ package at.gv.egiz.stal; + +import java.util.Locale; public interface STALFactory { - - public STAL createSTAL(); + public STAL createSTAL(); + public void setLocale(Locale locale); } \ No newline at end of file diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java index 0082de26..22ee0d1d 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/BindingProcessorManagerImpl.java @@ -187,6 +187,7 @@ public class BindingProcessorManagerImpl implements BindingProcessorManager { } BindingProcessor bindingProcessor = new HTTPBindingProcessor(aSessionId, commandInvokerClass.newInstance(), url); + stalFactory.setLocale(locale); STAL stal = stalFactory.createSTAL(); bindingProcessor.init(stal, commandInvokerClass.newInstance()); if (locale != null) { diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java index bb0314b5..775f4136 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/binding/DataUrlConnectionImpl.java @@ -36,6 +36,8 @@ import javax.net.ssl.HttpsURLConnection; import org.apache.commons.httpclient.methods.multipart.FilePart; import org.apache.commons.httpclient.methods.multipart.Part; import org.apache.commons.httpclient.methods.multipart.StringPart; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import at.gv.egiz.bku.binding.multipart.InputStreamPartSource; import at.gv.egiz.bku.binding.multipart.SLResultPart; @@ -49,6 +51,8 @@ import at.gv.egiz.bku.utils.binding.Protocol; * */ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { + + private final static Log log = LogFactory.getLog(DataUrlConnectionImpl.class); public final static Protocol[] SUPPORTED_PROTOCOLS = { Protocol.HTTP, Protocol.HTTPS }; @@ -80,10 +84,6 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { */ public void connect() throws SocketTimeoutException, IOException { connection = (HttpURLConnection) url.openConnection(); - - // FIXXME move this to config. - HttpURLConnection.setFollowRedirects(false); - connection.setDoOutput(true); Set headers = requestHttpHeaders.keySet(); Iterator headerIt = headers.iterator(); @@ -146,10 +146,14 @@ public class DataUrlConnectionImpl implements DataUrlConnectionSPI { Part[] parts = new Part[formParams.size()]; Part.sendParts(os, formParams.toArray(parts), boundary.getBytes()); os.close(); - // MultipartRequestEntity PostMethod - result = new DataUrlResponse(url.toString(), connection.getResponseCode(), - connection.getInputStream()); - + // MultipartRequestEntity PostMethod + InputStream is = null; + try { + is = connection.getInputStream(); + } catch (IOException iox) { + log.info(iox); + } + result = new DataUrlResponse(url.toString(), connection.getResponseCode(), is); Map responseHttpHeaders = new HashMap(); Map> httpHeaders = connection.getHeaderFields(); for (Iterator keyIt = httpHeaders.keySet().iterator(); keyIt diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java index 2330ed3f..8baa0137 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java @@ -463,6 +463,31 @@ public class Signature { log.trace("Reference caching is not enabled."); } } + for (Reference reference : getReferences()) { + if (reference.getType() != null) { + InputStream digestInputStream = reference.getDigestInputStream(); + if (digestInputStream != null) { + StringBuilder sb = new StringBuilder(); + sb.append("DigestInput for Reference with id='"); + sb.append(reference.getId()); + sb.append("'; Type:"); + sb.append(reference.getType()); + sb.append("):\n"); + try { + byte[] b = new byte[512]; + for (int l; (l = digestInputStream.read(b)) != -1;) { + sb.append(new String(b, 0, l)); + } + } catch (IOException e) { + log.error(e); + } + log.trace(sb.toString()); + } else { + log.trace("Reference caching is not enabled."); + } + + } + } } } diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java b/bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java index 45dcdc3a..f832f364 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/binding/DummyStalFactory.java @@ -16,6 +16,8 @@ */ package at.gv.egiz.bku.binding; +import java.util.Locale; + import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.STALFactory; @@ -25,6 +27,12 @@ public class DummyStalFactory implements STALFactory { public STAL createSTAL() { // TODO Auto-generated method stub return new at.gv.egiz.stal.dummy.DummySTAL(); + } + + @Override + public void setLocale(Locale locale) { + // TODO Auto-generated method stub + } } -- cgit v1.2.3 From 677bff2bdb7b2cb327930f0596d5f3133363295c Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 15 Sep 2008 18:00:30 +0000 Subject: encoding git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@38 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java index f9965240..5186de1a 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java @@ -74,11 +74,12 @@ public class WSSignRequestHandler extends SignRequestHandler { byte[] hdi = reference.getValue(); String id = reference.getID(); String mimeType = reference.getMimeType(); + String encoding = reference.getEncoding(); if (log.isDebugEnabled()) { - log.debug("Got HashDataInput " + id + " (" + mimeType + ")"); + log.debug("Got HashDataInput " + id + " (" + mimeType + ";" + encoding + ")"); } - hashDataInputs.add(new ByteArrayHashDataInput(hdi, id, mimeType)); + hashDataInputs.add(new ByteArrayHashDataInput(hdi, id, mimeType, encoding)); } return hashDataInputs; } -- cgit v1.2.3 From cf82096145bbdd548e388c1bc25f0e703b9b4624 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 17 Sep 2008 17:17:10 +0000 Subject: hashdatainput digest verification git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@44 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../bku/online/applet/WSSignRequestHandler.java | 139 +++++++---- .../gv/egiz/stal/impl/ByteArrayHashDataInput.java | 58 +++++ .../bku/local/stal/LocalSignRequestHandler.java | 14 +- .../gv/egiz/stal/impl/ByteArrayHashDataInput.java | 58 ----- .../at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java | 2 +- .../bku/smccstal/CashedHashDataInputResolver.java | 27 ++ .../gv/egiz/bku/smccstal/SignRequestHandler.java | 273 ++++++++++++++++----- 7 files changed, 404 insertions(+), 167 deletions(-) create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java delete mode 100644 STALService/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java create mode 100644 smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/CashedHashDataInputResolver.java (limited to 'BKUApplet') diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java index 5186de1a..6dae264c 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java @@ -16,15 +16,20 @@ */ package at.gv.egiz.bku.online.applet; -import at.gv.egiz.stal.HashDataInput; import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; import at.gv.egiz.bku.smccstal.SignRequestHandler; +import at.gv.egiz.stal.HashDataInput; import at.gv.egiz.stal.impl.ByteArrayHashDataInput; import at.gv.egiz.stal.service.GetHashDataInputResponseType; import at.gv.egiz.stal.service.GetHashDataInputType; import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.signedinfo.DigestMethodType; import at.gv.egiz.stal.signedinfo.ReferenceType; +import java.security.DigestException; +import java.security.MessageDigest; import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -35,57 +40,101 @@ import org.apache.commons.logging.LogFactory; */ public class WSSignRequestHandler extends SignRequestHandler { - private static final Log log = LogFactory.getLog(WSSignRequestHandler.class); - STALPortType stalPort; - String sessId; + private static final Log log = LogFactory.getLog(WSSignRequestHandler.class); + STALPortType stalPort; + String sessId; - public WSSignRequestHandler(String sessId, STALPortType stalPort) { - if (stalPort == null || sessId == null) { - throw new NullPointerException("STAL port must not be null"); - } - this.sessId = sessId; - this.stalPort = stalPort; + public WSSignRequestHandler(String sessId, STALPortType stalPort) { + if (stalPort == null || sessId == null) { + throw new NullPointerException("STAL port must not be null"); } + this.sessId = sessId; + this.stalPort = stalPort; + } - @Override - protected List getHashDataInputs(List dsigReferences) throws Exception { - GetHashDataInputType request = new GetHashDataInputType(); - request.setSessionId(sessId); - for (ReferenceType dsigRef : dsigReferences) { - //don't get Manifest, QualifyingProperties, ... - if (dsigRef.getType() == null) { - String dsigRefId = dsigRef.getId(); - if (dsigRefId != null) { - GetHashDataInputType.Reference reference = new GetHashDataInputType.Reference(); - reference.setID(dsigRefId); - request.getReference().add(reference); - } else { - throw new Exception("Cannot get HashDataInput for dsig:Reference without Id attribute"); - } - } - } + @Override + public List getCashedHashDataInputs(List signedReferences) throws Exception { - if (log.isDebugEnabled()) { - log.debug("Calling GetHashDataInput for session " + sessId); - } - GetHashDataInputResponseType response = stalPort.getHashDataInput(request); - ArrayList hashDataInputs = new ArrayList(); - for (GetHashDataInputResponseType.Reference reference : response.getReference()) { - byte[] hdi = reference.getValue(); - String id = reference.getID(); - String mimeType = reference.getMimeType(); - String encoding = reference.getEncoding(); + GetHashDataInputType request = new GetHashDataInputType(); + request.setSessionId(sessId); + + HashMap idRefMap = new HashMap(); + for (ReferenceType reference : signedReferences) { + //don't get Manifest, QualifyingProperties, ... + if (reference.getType() == null) { + String referenceId = reference.getId(); + if (referenceId != null) { + idRefMap.put(referenceId, reference); + GetHashDataInputType.Reference ref = new GetHashDataInputType.Reference(); + ref.setID(referenceId); + request.getReference().add(ref); - if (log.isDebugEnabled()) { - log.debug("Got HashDataInput " + id + " (" + mimeType + ";" + encoding + ")"); - } - hashDataInputs.add(new ByteArrayHashDataInput(hdi, id, mimeType, encoding)); + } else { + throw new Exception("Cannot resolve HashDataInput for reference without Id attribute"); } - return hashDataInputs; + } } - @Override - public SMCCSTALRequestHandler newInstance() { - return new WSSignRequestHandler(this.sessId, this.stalPort); + if (log.isDebugEnabled()) { + log.debug("Calling GetHashDataInput for session " + sessId); } + GetHashDataInputResponseType response = stalPort.getHashDataInput(request); + ArrayList hashDataInputs = new ArrayList(); + + for (GetHashDataInputResponseType.Reference reference : response.getReference()) { + + String id = reference.getID(); + byte[] hdi = reference.getValue(); + if (hdi == null) { + throw new Exception("Failed to resolve digest value for reference " + id); + } + String mimeType = reference.getMimeType(); + String encoding = reference.getEncoding(); + + if (log.isDebugEnabled()) { + log.debug("Got HashDataInput " + id + " (" + mimeType + ";" + encoding + ")"); + } + + ReferenceType dsigRef = idRefMap.get(id); + DigestMethodType dm = dsigRef.getDigestMethod(); + if (dm == null) { + throw new Exception("Failed to verify digest value for reference " + id + ": no digest algorithm"); + } + //TODO + String mdAlg = dm.getAlgorithm(); + if ("http://www.w3.org/2000/09/xmldsig#sha1".equals(mdAlg)) + mdAlg = "SHA-1"; + else if ("http://www.w3.org/2001/04/xmlenc#sha256".equals(mdAlg)) + mdAlg = "SHA-256"; + else if ("http://www.w3.org/2001/04/xmlenc#sha224 ".equals(mdAlg)) + mdAlg = "SHA-224"; + else if ("http://www.w3.org/2001/04/xmldsig-more#sha224 ".equals(mdAlg)) + mdAlg = "SHA-224"; + else if ("http://www.w3.org/2001/04/xmldsig-more#sha384".equals(mdAlg)) + mdAlg = "SHA-384"; + else if ("http://www.w3.org/2001/04/xmlenc#sha512".equals(mdAlg)) + mdAlg = "SHA-512"; + else if ("http://www.w3.org/2001/04/xmldsig-more#md2 ".equals(mdAlg)) + mdAlg = "MD2"; + else if ("http://www.w3.org/2001/04/xmldsig-more#md5".equals(mdAlg)) + mdAlg = "MD5"; + else if ("http://www.w3.org/2001/04/xmlenc#ripemd160 ".equals(mdAlg)) + mdAlg = "RipeMD-160"; + MessageDigest md = MessageDigest.getInstance(mdAlg); + byte[] hdiDigest = md.digest(hdi); + if (log.isDebugEnabled()) + log.debug("Comparing digest values... "); + if (!Arrays.equals(hdiDigest, dsigRef.getDigestValue())) { + log.error("digest values differ: " + new String(hdiDigest) + ", " + new String(dsigRef.getDigestValue())); + throw new DigestException("Bad digest value for reference " + id + ": " + dsigRef.getDigestValue()); + } + hashDataInputs.add(new ByteArrayHashDataInput(hdi, id, mimeType, encoding)); + } + return hashDataInputs; + } + + @Override + public SMCCSTALRequestHandler newInstance() { + return new WSSignRequestHandler(this.sessId, this.stalPort); + } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java b/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java new file mode 100644 index 00000000..b0285345 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java @@ -0,0 +1,58 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.stal.impl; + +import at.gv.egiz.stal.HashDataInput; +import java.io.ByteArrayInputStream; +import java.io.InputStream; + +/** + * + * @author clemens + */ +public class ByteArrayHashDataInput implements HashDataInput { + + protected byte[] hashData; + protected String id; + protected String mimeType; + protected String encoding; + + public ByteArrayHashDataInput(byte[] hashData, String id, String mimeType, String encoding) { + if (hashData == null) { + throw new NullPointerException("HashDataInput not provided."); + } + this.hashData = hashData; + this.id = id; + this.mimeType = mimeType; + this.encoding = encoding; + } + + @Override + public String getReferenceId() { + return id; + } + + @Override + public String getMimeType() { + return mimeType; + } + + @Override + public InputStream getHashDataInput() { + return new ByteArrayInputStream(hashData); + } + + /** + * may be null + * @return + */ + @Override + public String getEncoding() { + return encoding; + } + + +} diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java index f8546e49..a288a716 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java @@ -29,7 +29,10 @@ import at.gv.egiz.stal.HashDataInput; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; +import at.gv.egiz.stal.impl.ByteArrayHashDataInput; import at.gv.egiz.stal.signedinfo.ReferenceType; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; /** * @@ -55,7 +58,7 @@ public class LocalSignRequestHandler extends SignRequestHandler { } @Override - protected List getHashDataInputs( + public List getCashedHashDataInputs( List dsigReferences) throws Exception { ArrayList result = new ArrayList(); for (ReferenceType dsigRef : dsigReferences) { @@ -65,7 +68,14 @@ public class LocalSignRequestHandler extends SignRequestHandler { if (dsigRefId != null) { for (HashDataInput hdi : hashDataInput) { if (hdi.getReferenceId().equals(dsigRefId)) { - result.add(hdi); + InputStream hdIs = hdi.getHashDataInput(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(hdIs.available()); + int b; + while ((b = hdIs.read()) != -1) { + baos.write(b); + } + ByteArrayHashDataInput baHdi = new ByteArrayHashDataInput(baos.toByteArray(), hdi.getReferenceId(), hdi.getMimeType(), hdi.getEncoding()); + result.add(baHdi); } } } else { diff --git a/STALService/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java b/STALService/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java deleted file mode 100644 index b0285345..00000000 --- a/STALService/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -package at.gv.egiz.stal.impl; - -import at.gv.egiz.stal.HashDataInput; -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -/** - * - * @author clemens - */ -public class ByteArrayHashDataInput implements HashDataInput { - - protected byte[] hashData; - protected String id; - protected String mimeType; - protected String encoding; - - public ByteArrayHashDataInput(byte[] hashData, String id, String mimeType, String encoding) { - if (hashData == null) { - throw new NullPointerException("HashDataInput not provided."); - } - this.hashData = hashData; - this.id = id; - this.mimeType = mimeType; - this.encoding = encoding; - } - - @Override - public String getReferenceId() { - return id; - } - - @Override - public String getMimeType() { - return mimeType; - } - - @Override - public InputStream getHashDataInput() { - return new ByteArrayInputStream(hashData); - } - - /** - * may be null - * @return - */ - @Override - public String getEncoding() { - return encoding; - } - - -} diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java index 56c8340b..ac2b725c 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java @@ -45,7 +45,7 @@ public abstract class AbstractSMCCSTAL implements STAL { static { addRequestHandler(InfoboxReadRequest.class, new InfoBoxReadRequestHandler()); - addRequestHandler(SignRequest.class, new SignRequestHandler()); +// addRequestHandler(SignRequest.class, new SignRequestHandler()); } /** diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/CashedHashDataInputResolver.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/CashedHashDataInputResolver.java new file mode 100644 index 00000000..05af85d9 --- /dev/null +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/CashedHashDataInputResolver.java @@ -0,0 +1,27 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.bku.smccstal; + +import at.gv.egiz.stal.HashDataInput; +import at.gv.egiz.stal.impl.ByteArrayHashDataInput; +import at.gv.egiz.stal.signedinfo.ReferenceType; +import java.security.DigestException; +import java.util.List; +import java.util.Set; + +/** + * + * @author clemens + */ +public interface CashedHashDataInputResolver { + + /** + * implementations may verify the hashvalue + * @post-condition returned list != null + * @return + */ + List getCashedHashDataInputs(List signedReferences) throws DigestException, Exception; +} diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java index d37d0551..59eed55f 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java @@ -21,8 +21,6 @@ import java.io.InputStream; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBException; @@ -43,21 +41,26 @@ import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; import at.gv.egiz.stal.SignResponse; +import at.gv.egiz.stal.impl.ByteArrayHashDataInput; import at.gv.egiz.stal.signedinfo.ObjectFactory; import at.gv.egiz.stal.signedinfo.ReferenceType; import at.gv.egiz.stal.signedinfo.SignedInfoType; import at.gv.egiz.stal.util.JCEAlgorithmNames; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.security.DigestException; +import java.security.DigestInputStream; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Set; /** * This class is NOT thread-safe. * handleRequest() sets the SignedInfo which is used in providePIN. */ -public class SignRequestHandler extends AbstractRequestHandler implements - PINProvider { +public abstract class SignRequestHandler extends AbstractRequestHandler implements + CashedHashDataInputResolver { private static Log log = LogFactory.getLog(SignRequestHandler.class); private static JAXBContext jaxbContext; @@ -71,10 +74,10 @@ public class SignRequestHandler extends AbstractRequestHandler implements } } /** the SignedInfo of the current SignRequest */ - protected SignedInfoType signedInfo; - protected List hashDataInputs; +// protected SignedInfoType signedInfo; +// protected List hashDataInputs; - private int retryCounter = 0; +// private int retryCounter = 0; @SuppressWarnings("unchecked") @Override @@ -86,8 +89,7 @@ public class SignRequestHandler extends AbstractRequestHandler implements Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); InputStream is = new ByteArrayInputStream(signReq.getSignedInfo()); JAXBElement si = (JAXBElement) unmarshaller.unmarshal(is); - signedInfo = si.getValue(); - String signatureMethod = signedInfo.getSignatureMethod().getAlgorithm(); + String signatureMethod = si.getValue().getSignatureMethod().getAlgorithm(); log.debug("Found signature method: " + signatureMethod); String jceName = JCEAlgorithmNames.getJCEHashName(signatureMethod); if (jceName == null) { @@ -97,7 +99,7 @@ public class SignRequestHandler extends AbstractRequestHandler implements MessageDigest md = MessageDigest.getInstance(jceName); md.update(signReq.getSignedInfo()); KeyboxName kb = SignatureCard.KeyboxName.getKeyboxName(signReq.getKeyIdentifier()); - byte[] resp = card.createSignature(md.digest(), kb, this); + byte[] resp = card.createSignature(md.digest(), kb, new STALPinProvider(si.getValue())); if (resp == null) { return new ErrorResponse(6001); } @@ -116,9 +118,7 @@ public class SignRequestHandler extends AbstractRequestHandler implements } catch (NoSuchAlgorithmException e) { log.error(e); return new ErrorResponse(1000); - } finally { - signedInfo = null; - } + } } else { log.fatal("Got unexpected STAL request: " + request); return new ErrorResponse(1000); @@ -130,59 +130,210 @@ public class SignRequestHandler extends AbstractRequestHandler implements return true; } - @Override - public String providePIN(PINSpec spec, int retries) { - if (retryCounter++ > 0) { - log.info("PIN wrong retrying ..."); - gui.showSignaturePINRetryDialog(spec, retries, this, "sign", this, - "cancel", this, "hashData"); - } else { - gui.showSignaturePINDialog(spec, this, "sign", this, "cancel", this, - "hashData"); - } - do { - waitForAction(); - if (actionCommand.equals("cancel")) { - return null; - } else if (actionCommand.equals("hashData")) { - if (signedInfo != null) { - try { - gui.showWaitDialog(null); - if (hashDataInputs == null || hashDataInputs.size() == 0) { - hashDataInputs = getHashDataInputs(signedInfo.getReference()); - } - gui.showHashDataInputDialog(hashDataInputs, this, "ok"); - } catch (Exception ex) { - //FIXME localize messages - log.error("Failed to obtain HashDataInputs: " + ex.getMessage()); - gui.showErrorDialog("Failed to obtain HashDataInputs: " + ex.getMessage(), this, "ok"); - } - } else { - //FIXME get all hashdatainputs - gui.showErrorDialog("Failed to obtain HashDataInputs: No dsig:SignedInfo provided.", this, "ok"); - } - } else if (actionCommand.equals("sign")) { - return new String(gui.getPin()); - } else if (actionCommand.equals("ok")) { - gui.showSignaturePINDialog(spec, this, "sign", this, "cancel", this, - "hashData"); - } - } while (true); - } +// @Override +// public String providePIN(PINSpec spec, int retries) { +// if (retryCounter++ > 0) { +// log.info("PIN wrong retrying ..."); +// gui.showSignaturePINRetryDialog(spec, retries, this, "sign", this, +// "cancel", this, "hashData"); +// } else { +// gui.showSignaturePINDialog(spec, this, "sign", this, "cancel", this, +// "hashData"); +// } +// do { +// waitForAction(); +// if (actionCommand.equals("cancel")) { +// return null; +// } else if (actionCommand.equals("hashData")) { +// if (signedInfo != null) { +// try { +// gui.showWaitDialog(null); +// if (hashDataInputs == null || hashDataInputs.size() == 0) { +// HashMap signedReferences = new HashMap(); +// for (ReferenceType reference : signedInfo.getReference()) { +// //don't get Manifest, QualifyingProperties, ... +// if (reference.getType() == null) { +// signedReferences.put(reference.getId(), reference); +// } +// } +// hashDataInputs = getHashDataInputs(signedReferences.keySet()); +// for (HashDataInput hashDataInput : hashDataInputs) { +// ReferenceType reference = signedReferences.get(hashDataInput.getReferenceId()); +// String algorithm = reference.getDigestMethod().getAlgorithm(); +// MessageDigest md = MessageDigest.getInstance(algorithm); +// DigestInputStream dis = new DigestInputStream(hashDataInput.getHashDataInput(), md); +// while(dis.read() != -1) ; +// byte[] digestValue = md.digest(); +// boolean valid = reference.getDigestValue().equals(digestValue); +// } +// } +// gui.showHashDataInputDialog(hashDataInputs, this, "ok"); +// } catch (Exception ex) { +// //FIXME localize messages +// log.error("Failed to obtain HashDataInputs: " + ex.getMessage()); +// gui.showErrorDialog("Failed to obtain HashDataInputs: " + ex.getMessage(), this, "ok"); +// } +// } else { +// //FIXME get all hashdatainputs +// gui.showErrorDialog("Failed to obtain HashDataInputs: No dsig:SignedInfo provided.", this, "ok"); +// } +// } else if (actionCommand.equals("sign")) { +// return new String(gui.getPin()); +// } else if (actionCommand.equals("ok")) { +// gui.showSignaturePINDialog(spec, this, "sign", this, "cancel", this, +// "hashData"); +// } +// } while (true); +// } - @Override - public SMCCSTALRequestHandler newInstance() { - return new SignRequestHandler(); - } +// @Override +// public SMCCSTALRequestHandler newInstance() { +// return new SignRequestHandler(); +// } /** - * override by subclass + * implementations may verify the hashvalue * @post-condition returned list != null * @return */ - protected List getHashDataInputs(List signedReferences) throws Exception { - //TODO - log.warn("Return empty HashDataInput"); - return new ArrayList(); + @Override + public abstract List getCashedHashDataInputs(List signedReferences) throws Exception; +// { +// //TODO +// log.warn("Return empty HashDataInput"); +// return new ArrayList(); +// } + + + +// protected void validateHashDataInputs(List signedReferences, List hashDataInputs) { +// if (hashDataInputs != null) { +// +// Map hashDataIdMap = new HashMap(); +// for (HashDataInput hdi : hashDataInputs) { +// if (log.isTraceEnabled()) { +// log.trace("Provided HashDataInput for reference " + hdi.getReferenceId()); +// } +// hashDataIdMap.put(hdi.getReferenceId(), hdi); +// } +// +// List reqRefs = request.getReference(); +// for (GetHashDataInputType.Reference reqRef : reqRefs) { +// String reqRefId = reqRef.getID(); +// HashDataInput reqHdi = hashDataIdMap.get(reqRefId); +// if (reqHdi == null) { +// String msg = "Failed to resolve HashDataInput for reference " + reqRefId; +// log.error(msg); +// GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); +// faultInfo.setErrorCode(1); +// faultInfo.setErrorMessage(msg); +// throw new GetHashDataInputFault(msg, faultInfo); +// } +// +// InputStream hashDataIS = reqHdi.getHashDataInput(); +// if (hashDataIS == null) { +// //HashDataInput not cached? +// String msg = "Failed to obtain HashDataInput for reference " + reqRefId + ", reference not cached"; +// log.error(msg); +// GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); +// faultInfo.setErrorCode(1); +// faultInfo.setErrorMessage(msg); +// throw new GetHashDataInputFault(msg, faultInfo); +// } +// ByteArrayOutputStream baos = null; +// try { +// if (log.isDebugEnabled()) { +// log.debug("Resolved HashDataInput " + reqRefId + " (" + reqHdi.getMimeType() + ";charset=" + reqHdi.getEncoding() + ")"); +// } +// baos = new ByteArrayOutputStream(hashDataIS.available()); +// int c; +// while ((c = hashDataIS.read()) != -1) { +// baos.write(c); +// } +// GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference(); +// ref.setID(reqRefId); +// ref.setMimeType(reqHdi.getMimeType()); +// ref.setEncoding(reqHdi.getEncoding()); +// ref.setValue(baos.toByteArray()); +// response.getReference().add(ref); +// } catch (IOException ex) { +// String msg = "Failed to get HashDataInput for reference " + reqRefId; +// log.error(msg, ex); +// GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); +// faultInfo.setErrorCode(1); +// faultInfo.setErrorMessage(msg); +// throw new GetHashDataInputFault(msg, faultInfo, ex); +// } finally { +// try { +// baos.close(); +// } catch (IOException ex) { +// } +// } +// } +// return response; +// } +// for (ReferenceType reference : signedReferences) { +// String algorithm = reference.getDigestMethod().getAlgorithm(); +// +// } +// } + + + /** + * cashes the HashDataInputs provided by SignRequestHandler.this.getHashDataInputs() + * (don't know whether outer class is LocalSignRequestHandler or WSSignRequestHandler, providing DataObjectHDI or ByteArrayHDI, resp) + */ + class STALPinProvider implements PINProvider { + + protected SignedInfoType signedInfo; + protected List hashDataInputs; + private int retryCounter = 0; + + public STALPinProvider(SignedInfoType signedInfo) { + this.signedInfo = signedInfo; + } + + @Override + public String providePIN(PINSpec spec, int retries) { + if (retryCounter++ > 0) { + log.info("PIN wrong retrying ..."); + gui.showSignaturePINRetryDialog(spec, retries, SignRequestHandler.this, "sign", SignRequestHandler.this, + "cancel", SignRequestHandler.this, "hashData"); + } else { + gui.showSignaturePINDialog(spec, SignRequestHandler.this, "sign", SignRequestHandler.this, "cancel", SignRequestHandler.this, + "hashData"); } + do { + waitForAction(); + if (actionCommand.equals("cancel")) { + return null; + } else if (actionCommand.equals("hashData")) { + if (signedInfo != null) { + try { + gui.showWaitDialog(null); + if (hashDataInputs == null || hashDataInputs.size() == 0) { + hashDataInputs = getCashedHashDataInputs(signedInfo.getReference()); + } + gui.showHashDataInputDialog(hashDataInputs, SignRequestHandler.this, "ok"); + } catch (DigestException ex) { + log.error("Bad digest value: " + ex.getMessage()); + gui.showErrorDialog(ex.getMessage()); + } catch (Exception ex) { + //FIXME localize messages + log.error("Failed to obtain HashDataInputs: " + ex.getMessage()); + gui.showErrorDialog("Failed to obtain HashDataInputs: " + ex.getMessage(), SignRequestHandler.this, "ok"); + } + } else { + //FIXME get all hashdatainputs + gui.showErrorDialog("Failed to obtain HashDataInputs: No dsig:SignedInfo provided.", SignRequestHandler.this, "ok"); + } + } else if (actionCommand.equals("sign")) { + return new String(gui.getPin()); + } else if (actionCommand.equals("ok")) { + gui.showSignaturePINDialog(spec, SignRequestHandler.this, "sign", SignRequestHandler.this, "cancel", SignRequestHandler.this, + "hashData"); + } + } while (true); + } + } } -- cgit v1.2.3 From 03f5ae9e9068168b294c042d68a58637e71a54ee Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 23 Sep 2008 14:09:02 +0000 Subject: bitte warten... git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@59 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java | 2 +- BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 3 ++- smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'BKUApplet') 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 cd96a481..465bde78 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 @@ -283,7 +283,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, } break; case SMCCHelper.CARD_FOUND: - gui.showWaitDialog(null); +// gui.showWaitDialog(null); signatureCard = smccHelper.getSignatureCard(errorMessages.getLocale()); return false; } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java index 0b68962c..544b6eb3 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java @@ -246,7 +246,8 @@ public class BKUGUI implements BKUGUIFacade { headerPanelLayout.setHorizontalGroup( headerPanelLayout.createSequentialGroup() // headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); + .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) + .addContainerGap()); headerPanelLayout.setVerticalGroup( headerPanelLayout.createSequentialGroup() // headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java index 8f380eec..0b297283 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java @@ -311,7 +311,7 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen } else if (actionCommand.equals("hashData")) { if (signedInfo != null) { try { - gui.showWaitDialog(null); +// gui.showWaitDialog(null); if (hashDataInputs == null || hashDataInputs.size() == 0) { hashDataInputs = getCashedHashDataInputs(signedInfo.getReference()); } -- cgit v1.2.3 From 0168154a4a0777fd7ae2bc3a097c12b33781d75a Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 24 Sep 2008 13:08:04 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@61 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java | 1 + BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'BKUApplet') 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 c7df0871..34dd9bbd 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 @@ -48,6 +48,7 @@ public class BKUApplet extends JApplet { } public void init() { + log.info("Welcome to MOCCA\n"); log.debug("Called init()"); HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance()); String localeString = getMyAppletParameter(LOCALE_PARAM_KEY); 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 465bde78..8190e5ec 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 @@ -175,7 +175,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, nextRequest.getResponse().addAll(responses); } while (!finished); log.info("Done " + Thread.currentThread().getName()); - gui.showWelcomeDialog(); +// gui.showWelcomeDialog(); sendRedirect(); } -- cgit v1.2.3 From afa2741d7257ee3e98f400e211d96f584c4ef778 Mon Sep 17 00:00:00 2001 From: wbauer Date: Fri, 26 Sep 2008 13:36:57 +0000 Subject: added error dialog for unexpected internal errors git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@74 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUWorker.java | 131 +++++++++++---------- BKUOnline/src/main/webapp/appletPage.jsp | 4 +- 2 files changed, 72 insertions(+), 63 deletions(-) (limited to 'BKUApplet') 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 8190e5ec..35fe652f 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 @@ -1,19 +1,19 @@ /* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package at.gv.egiz.bku.online.applet; import java.awt.event.ActionEvent; @@ -73,11 +73,12 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, this.parent = parent; this.errorMessages = errorMessageBundle; addRequestHandler(QuitRequest.class, this); - //register SignRequestHandler once we have a webservice port + // register SignRequestHandler once we have a webservice port } - + /** * Used for non applet variants + * * @param gui * @param errorMessageBundle */ @@ -96,7 +97,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, try { if (codebase.getProtocol().equalsIgnoreCase("file")) { // for debugging in appletrunner - wsdlURL = new URL(wsdlLocation); + wsdlURL = new URL(wsdlLocation); } else { wsdlURL = new URL(codebase, wsdlLocation); } @@ -120,8 +121,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, gui.showWelcomeDialog(); try { stalPort = getSTALPort(); - - + } catch (Exception e) { log.fatal("Failed to call STAL service.", e); actionCommandList.clear(); @@ -134,48 +134,57 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, } return; } + try { + ObjectFactory factory = new ObjectFactory(); + GetNextRequestType nextRequest = factory.createGetNextRequestType(); - ObjectFactory factory = new ObjectFactory(); - GetNextRequestType nextRequest = factory.createGetNextRequestType(); - - String sessionId = parent.getMyAppletParameter(BKUApplet.SESSION_ID); - if (sessionId == null) { - // use the testsession for testing - sessionId = "TestSession"; - } - nextRequest.setSessionId(sessionId); - addRequestHandler(SignRequest.class, new WSSignRequestHandler(sessionId, stalPort)); - do { - GetNextRequestResponseType resp = stalPort.getNextRequest(nextRequest); - log.info("Got " + resp.getRequest().size() + " requests from server."); - List stalRequests = resp.getRequest(); - boolean handle = true; - for (STALRequest request : stalRequests) { - if (request instanceof InfoboxReadRequest) { - InfoboxReadRequest infobx = (InfoboxReadRequest) request; - if (infobx.getInfoboxIdentifier().equals("IdentityLink")) { - if (infobx.getDomainIdentifier() == null) { - if (!InternalSSLSocketFactory.getInstance().isEgovAgency()) { - handle = false; - } - } - } - } - } - List responses; - if (handle) { - responses = handleRequest(stalRequests); - } else { - responses = new ArrayList(1); - responses.add(new ErrorResponse(6002)); + String sessionId = parent.getMyAppletParameter(BKUApplet.SESSION_ID); + if (sessionId == null) { + // use the testsession for testing + sessionId = "TestSession"; } - log.info("Got " + responses.size() + " responses."); - nextRequest = factory.createGetNextRequestType(); nextRequest.setSessionId(sessionId); - nextRequest.getResponse().addAll(responses); - } while (!finished); - log.info("Done " + Thread.currentThread().getName()); -// gui.showWelcomeDialog(); + addRequestHandler(SignRequest.class, new WSSignRequestHandler(sessionId, + stalPort)); + do { + GetNextRequestResponseType resp = stalPort.getNextRequest(nextRequest); + log.info("Got " + resp.getRequest().size() + " requests from server."); + List stalRequests = resp.getRequest(); + boolean handle = true; + for (STALRequest request : stalRequests) { + if (request instanceof InfoboxReadRequest) { + InfoboxReadRequest infobx = (InfoboxReadRequest) request; + if (infobx.getInfoboxIdentifier().equals("IdentityLink")) { + if (infobx.getDomainIdentifier() == null) { + if (!InternalSSLSocketFactory.getInstance().isEgovAgency()) { + handle = false; + } + } + } + } + } + List responses; + if (handle) { + responses = handleRequest(stalRequests); + } else { + responses = new ArrayList(1); + responses.add(new ErrorResponse(6002)); + } + log.info("Got " + responses.size() + " responses."); + nextRequest = factory.createGetNextRequestType(); + nextRequest.setSessionId(sessionId); + nextRequest.getResponse().addAll(responses); + } while (!finished); + log.info("Done " + Thread.currentThread().getName()); + // gui.showWelcomeDialog(); + } catch (Exception ex) { + gui.showErrorDialog("Sorry, an internal error occured: " + ex.getMessage()); + try { + waitForAction(); + } catch (InterruptedException e) { + log.error(e); + } + } sendRedirect(); } @@ -187,7 +196,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, URL url = null; if (redirectURL != null) { try { - url = new URL(parent.getCodeBase(),redirectURL + ";jsessionid=" + url = new URL(parent.getCodeBase(), redirectURL + ";jsessionid=" + parent.getMyAppletParameter(BKUApplet.SESSION_ID)); } catch (MalformedURLException ex) { log.warn("Parameter 'redirectURL': " + redirectURL @@ -283,7 +292,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, } break; case SMCCHelper.CARD_FOUND: -// gui.showWaitDialog(null); + // gui.showWaitDialog(null); signatureCard = smccHelper.getSignatureCard(errorMessages.getLocale()); return false; } diff --git a/BKUOnline/src/main/webapp/appletPage.jsp b/BKUOnline/src/main/webapp/appletPage.jsp index 041591f3..5f208a2a 100644 --- a/BKUOnline/src/main/webapp/appletPage.jsp +++ b/BKUOnline/src/main/webapp/appletPage.jsp @@ -26,9 +26,9 @@ - -
+ diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/award.gif b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/award.gif new file mode 100644 index 00000000..8807fcf6 Binary files /dev/null and b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/award.gif differ diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/bmf_01.gif b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/bmf_01.gif new file mode 100644 index 00000000..dd7697a4 Binary files /dev/null and b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/bmf_01.gif differ diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/bmf_02.gif b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/bmf_02.gif new file mode 100644 index 00000000..961d511e Binary files /dev/null and b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/bmf_02.gif differ diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/browser.js b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/browser.js new file mode 100644 index 00000000..6fbf74f0 --- /dev/null +++ b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/browser.js @@ -0,0 +1,165 @@ +var BrowserDetect = { + init: function () { + this.browser = this.searchString(this.dataBrowser) || "An unknown browser"; + this.version = this.searchVersion(navigator.userAgent) + || this.searchVersion(navigator.appVersion) + || "an unknown version"; + this.OS = this.searchString(this.dataOS) || "an unknown OS"; + }, + searchString: function (data) { + for (var i=0;i
"); + document.write("Sehr geehrter FinanzOnline-Teilnehmer!

Die Menüführung in FinanzOnline wurde aus technischen Gründen geändert. Da Sie möglicherweise eine veraltete und nicht mehr dem letzten Sicherheitsstandard entsprechende Version Ihres Webbrowsers verwenden, besteht ab diesem Zeitpunkt die Möglichkeit, dass das Menü in FinanzOnline nicht richtig angezeigt werden kann.

Wir empfehlen daher bereits heute auch zu Ihrer Sicherheit, ein Update auf die aktuell gültige Browserversion durchzuführen. Die unterstützten Webbrowser finden Sie auf der BMF-Homepage unter 'E-Government'/'FinanzOnline'/'Browsereinstellungen'.

"); + + +/* document.write("Verwendeter Browser: " + BrowserDetect.browser + " " + BrowserDetect.version + " / " + BrowserDetect.OS); + if(BrowserDetect.browser.toLowerCase() == "explorer") { + if(eval(BrowserDetect.version) < 6) { + document.write(" *** nicht supported ***"); + } else { + //document.write(" *** supported ***"); + } + } + if(BrowserDetect.browser.toLowerCase() == "opera") { + if(eval(BrowserDetect.version) < 9) { + document.write(" *** nicht supported ***"); + } else { + //document.write(" *** supported ***"); + } + } + if(BrowserDetect.browser.toLowerCase() == "firefox") { + if(eval(BrowserDetect.version) < 1.5) { + document.write(" *** nicht supported ***"); + } else { + //document.write(" *** supported ***"); + } + } +// document.write("

Vorschlag fr untersttze Browser:
"); +// document.write("
  • Internet Explorer 6, PC
  • "); +// document.write("
  • Internet Explorer 7, PC
  • "); +// document.write("
  • Firefox (>= 1.5), PC + Mac + Linux
  • "); +// document.write("
  • Safari (>= 1.3+), Mac (<- WIE TESTEN??)
  • "); +// document.write("
  • Opera (>= 9), PC + Mac + Linux
  • "); +// document.write("
"); +*/ + document.write("
 "); + + } +} \ No newline at end of file diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/buergerkarte.gif b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/buergerkarte.gif new file mode 100644 index 00000000..99d5f37e Binary files /dev/null and b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/buergerkarte.gif differ diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/eps-logo.gif b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/eps-logo.gif new file mode 100644 index 00000000..6f4ee65c Binary files /dev/null and b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/eps-logo.gif differ diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/epsa-award.jpg b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/epsa-award.jpg new file mode 100644 index 00000000..0e68626d Binary files /dev/null and b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/epsa-award.jpg differ diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/fon.css b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/fon.css new file mode 100644 index 00000000..f9b7b229 --- /dev/null +++ b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/fon.css @@ -0,0 +1,553 @@ +BODY { + margin-left : 0px; + margin-right : 0px; + margin-top : 0px; + color : black; + background-color : #E8F4FE; + font-family : Verdana, Geneva, Arial, Helvetica, sans-serif, sans-serif; + font-size:13px; + font-weight: normal; +} +table.user { + background-color: #D6E6F9; + width: 100%; + font-family:Verdana,Arial,Helv; + font-size:13px; +} + +.BUT { + HEIGHT: 20px; + BORDER:1px solid #000000; + TEXT-DECORATION:none; + BACKGROUND-IMAGE:url(../graphics/butback.gif); +} + +A { + color : #000000; +} + + +TH.label { + padding: 10px; + margin-left: 10px; + font-size: 13px; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + font-weight: bold; + color: #D6E6F9; + background-color: #006699; + vertical-align: top +} + +TH.label_hell { + padding : 5px; + margin-left : 10px; + font-size : 13px; + font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; + font-weight : bold; + color : #000000; + background-color : #D6E6F9; + vertical-align : top; + text-align : left; +} +TD.input { + padding : 5px; + margin-left : 10px; + font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; + color : #000000; + background-color : #D6E6F9; + vertical-align : middle; + text-align : right; + font-size: 13px; +} + +TD.input_links { + padding: 5px; + margin-left: 10px; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color: #000000; + background-color: #D6E6F9; + vertical-align: bottom; + text-align: left; + font-size: 13px; +} + +TD.input_center { + padding: 5px; + margin-left: 10px; + font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; + color: #000000; + background-color: #D6E6F9; + vertical-align: bottom; + text-align: center; + font-size: 13px; +} + +TD.input_mitte { + padding : 5px; + margin-left : 10px; + font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; + color : #000000; + background-color : #D6E6F9; + vertical-align : middle; + text-align : left; + font-size: 13px; +} + +TD.spacer { + padding : 5px; + margin-left : 10px; + background-color : #D6E6F9; + vertical-align : top; + font-size: 50%; +} +TD.erlaeut2 { + padding : 5px; + margin-left : 5px; + font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; + color : #000000; + background-color : #D6E6F9; + vertical-align : top; + font-size: 13px; +} +TD.erlaeut { + padding : 5px; + margin-left : 10px; + font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; + color : #000000; + background-color : #D6E6F9; + vertical-align : top; + font-size: 13px; +} +TD.erlaeut_white { + margin-left : 10px; + font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; + color : #000000; + background-color : #D6E5F8; + vertical-align : top; + font-size: 13px; +} +TD.login { + padding : 5px; + margin-left : 10px; + font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; + color : #000000; + vertical-align : top; + font-size: 13px; +} +.tabcap { + margin-left : 10px; + font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; + font-weight : bold; + color : #D6E6F9; + background-color : #6699CC; + font-size : 13px; + font-weight : bold; + padding : 5px; + padding-top:1px; + padding-bottom:1px; +} + +INPUT { + font-family : Verdana,Arial,Helv; + font-size : 8pt; + color : #000000; +} + +TD.erlaeut_fett { + padding : 5px; + margin-left : 10px; + font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; + color : #000000; + background-color : #D6E6F9; + vertical-align : top; + font-size : 13px; + font-weight : bold; +} + + +TABLE.normal { + width : 100%; +} +CAPTION.cap { + width : 100%; + padding : 10px; + font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; + color : black; + background-color : #E8FDFD; + font-size : 11pt; + font-weight : bold; +} + +H1{ + color : #D6E6F9; + text-align : center; + border-left-color: #996666; + padding-top: 0px; + padding-right: 0px; + padding-bottom: 0px; + padding-left: 10px; + ; + border-style: solid; + border-top-width: 0px; + border-right-width: 0px; + border-bottom-width: 0px; + border-left-width : 0px; + background-color : #006699; +} +H2{ + color : #006699; + text-align : center; + font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; + padding-top: 0px; + padding-right: 0px; + padding-bottom: 0px; + padding-left: 10px; + font-size : 25px; +} +H3{ + color : #006699;; + text-align : center; + border-left-color: #996666; + padding-top: 0px; + padding-right: 0px; + padding-bottom: 0px; + padding-left: 10px; + border-style: solid; + border-top-width: 0px; + border-right-width: 0px; + border-bottom-width: 0px; + border-left-width : 0px; +} +H3.info_center{ + color : #006699; + text-align : center; + padding-top: 0px; + padding-right: 0px; + padding-bottom: 0px; + padding-left: 10px; + border-style: solid; + border-top-width: 0px; + border-right-width: 0px; + border-bottom-width: 0px; + border-left-width : 0px; +} +.inv{ + color : #D6E6F9; + text-align : left; + background-color : #006699; + font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size : 13px; + width: 100%; +} +.inv2{ + color : #D6E6F9; + text-align : left; + background-color : #006699; + font-family : Verdana, Geneva, Arial, Helvetica, sans-serif; + font-size : 13px; + width: 100%; + font-weight: bold; +} +H4{ + color : #006699; + text-align : center; + border-left-color: #996666; + padding-top: 0px; + padding-right: 0px; + padding-bottom: 0px; + padding-left: 10px; + border-style: solid; + border-top-width: 0px; + border-right-width: 0px; + border-bottom-width: 0px; + border-left-width : 0px; +} +H5{ + color : #006699; + text-align : center; + border-left-color: #996666; + padding-top: 0px; + padding-right: 0px; + padding-bottom: 0px; + padding-left: 10px; + border-style: solid; + border-top-width: 0px; + border-right-width: 0px; + border-bottom-width: 0px; + border-left-width : 0px; +} + +HR{ + height: 3px; +} +#erlauet{ + color : #006699; + text-align : left; + border-left-color: #996666; + padding: 5px 5px 5px 5px; + +} +#darkblock{ + background-color : #99CCFF; + text-align : left; + padding : 5px 5px 5px 5px; +font-size : 13px; +} +#lightblock{ + background-color : #D6E6F9; + text-align : left; + padding : 5px 5px 5px 5px; +font-size : 13px; +} +.versiontext { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 6pt; + color: #6b6b6b; + font-style: normal; + text-decoration: none; + text-align: right; + padding-right : 5px; +} +.navitext { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 7pt; + font-weight: bold; + color: #000000; + font-style: normal; + text-decoration: underline; +} +.navitext:hover { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 7pt; + font-weight: bold; + color: black; + font-style: normal; + text-decoration: underline; +} +a.pagelinks { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 9pt; + color: #000000; +} +a.pagelinks:hover { + color: gray; +} + +a.menulinks { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 10pt; + font-weight: normal; + color: #000000; + font-style: normal; + text-decoration: underline; +} +a.menulinks:hover { + text-decoration: underline; +} +.link_dbx +{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight: normal; + text-decoration: underline; + color: #000000; +} +.link_dbx:hover +{ + color: #000000; + text-decoration: underline; +} +.link_nav +{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight: normal; + text-decoration: underline; + color: #000000; +} + +.link_nav:hover +{ + color : gray; + text-decoration: underline; +} + +.link +{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight: bold; + text-decoration: underline; + color: #D6E5F8; +} + +.link:hover +{ + color: white; +} + +.link_fett +{ + font-family: Verdana, Arial, Helvetica, sans-serif; + font-weight: bold; + text-decoration: underline; + color: #D6E5F8; +} +.link_fett:hover +{ + color: #000000; + text-decoration: underline; +} +.header { font-family:Verdana,Arial,Helv; font-size:12px; margin-left:5px; font-weight:bold; text-decoration:none; color:#D6E5F8;} + +/* Definitionen fr die Meldungen (hostmeld.inc) */ +.meld { +background-color: white; +color : black; +padding: 5px; +margin: 2px; +margin-bottom: 10px; +border: 6px solid; +} +.ok { +border-color: #199919; +} +.fehler { +border-color: #ff4c4c; +} +.hinweis { +border-color: #003399; +} +.fehlerfeld { +color: red; +font-weight: bolder; +} + +#tabheader { + color : #D6E6F9; + background-color : #6699CC; + font-size : 13px; + font-weight : bold; + padding : 5px; + padding-top:1px; + padding-bottom:1px; +} +#tab { + background-color : #D6E6F9; + margin-top: 2px; + padding : 5px; +} + + +/* ================================================================ +This copyright notice must be untouched at all times. + +The original version of this stylesheet and the associated (x)html +is available at http://www.cssplay.co.uk/menus/simple_vertical.html +Copyright (c) 2005-2007 Stu Nicholls. All rights reserved. +This stylesheet and the associated (x)html may be modified in any +way to fit your requirements. +=================================================================== */ + +/* Add a margin - for this demo only - and a relative position with a high z-index to make it appear over any element below */ +#menu_container {width:100%; height:22px; z-index:100; background-color: #cccccc;} + +/* Get rid of the margin, padding and bullets in the unordered lists */ +#pmenu, #pmenu ul {padding:0; margin:0; list-style-type: none;} + +/* Set up the link size, color and borders */ +#pmenu a, #pmenu a:visited {display:block; font-size:10pt; color:#000000; text-decoration:none; text-indent:5px; + border:1px solid; border-width:1px 0 1px 1px; border-bottom-color: gray; border-top-color: white; + border-left-color: white; border-right-color: gray; + min-height:20px; + line-height:20px; + height:20px; + height:auto !important; + } + +/* Breitenangaben mit child selector: funkt nicht mit IE < 7. */ +#pmenu > li > ul a {width:170px;} /* LVL 1 Diese Selektion haut im IE6 nicht hin */ +#pmenu > li > ul > li > ul a {width:200px;} /* LVL 2 Diese Selektion haut im IE6 nicht hin */ +/* Breitenangaben ohne child selector: fr IE6 */ +#pmenu * a { width:100px; } +#pmenu * * a { width:200px; } + +/* Set up the sub level borders */ +#pmenu li ul li a, #pmenu li ul li a:visited {border-width:0 1px 1px 1px;} +#pmenu li a.enclose, #pmenu li a.enclose:visited {border-width:1px;} + +/* Set up the list items */ +#pmenu li {float:left; background:#cccccc;} /* orig: #7484ad;*/ + +/* For Non-IE browsers and IE7 */ +#pmenu li:hover {position:relative;} +/* Make the hovered list color persist */ +#pmenu li:hover > a {background:#006699; color:#ffffff;} /* orig: #dfd7ca;*/ +/* Set up the sublevel lists with a position absolute for flyouts and overrun padding. The transparent gif is for IE to work */ +#pmenu li ul {display:none;} +/* For Non-IE and IE7 make the sublevels visible on list hover. This is all it needs */ +#pmenu li:hover > ul {display:block; position:absolute; top:-11px; left:80px; padding:10px 30px 30px 30px; background:transparent url('../graphics/transparent.gif'); width:120px;} +/* Position the first sub level beneath the top level liinks */ +#pmenu > li:hover > ul {left:-30px; top:12px;} + +/* get rid of the table */ +#pmenu table {position:absolute; border-collapse:collapse; top:0; left:0; z-index:100; font-size:1em;} + +/* For IE5.5 and IE6 give the hovered links a position relative and a change of background and foreground color. This is needed to trigger IE to show the sub levels */ +* html #pmenu li a:hover {position:relative; background:#006699; color:#ffffff;} /* IE6: aktiv wenn Link hoovert */ + +/* For accessibility of the top level menu when tabbing */ +#pmenu li a:active, #pmenu li a:focus {background:#006699; color:#ffffff;} /* IE6: aktiv wenn Link hoovert */ + +/* Set up the pointers for the sub level indication */ +#pmenu li.fly {background:#cccccc url('../graphics/fly.gif') no-repeat right center;} /* orig: #7484ad;*/ +#pmenu li.drop {background:#cccccc url('../graphics/drop.gif') no-repeat right center;} /* orig: #7484ad;*/ + + +/* This lot is for IE5.5 and IE6 ONLY and is necessary to make the sublevels appear */ + +/* change the drop down levels from display:none; to visibility:hidden; */ +* html #pmenu li ul { visibility:hidden; display:block; position:absolute; top:-11px; left:80px; padding:10px 30px 30px 30px; background:transparent url('../graphics/transparent.gif');} + +/* keep the third level+ hidden when you hover on first level link */ +#pmenu li a:hover ul ul{ +visibility:hidden; +} +/* keep the fourth level+ hidden when you hover on second level link */ +#pmenu li a:hover ul a:hover ul ul{ +visibility:hidden; +} +/* keep the fifth level hidden when you hover on third level link */ +#pmenu li a:hover ul a:hover ul a:hover ul ul{ +visibility:hidden; +} +/* keep the sixth level hidden when you hover on fourth level link */ +#pmenu li a:hover ul a:hover ul a:hover ul a:hover ul ul { +visibility:hidden; +} + +/* make the second level visible when hover on first level link and position it */ +#pmenu li a:hover ul { +visibility:visible; left:-30px; top:14px; lef\t:-31px; to\p:15px; +} + +/* make the third level visible when you hover over second level link and position it and all further levels */ +#pmenu li a:hover ul a:hover ul{ +visibility:visible; top:-11px; left:80px; +} +/* make the fourth level visible when you hover over third level link */ +#pmenu li a:hover ul a:hover ul a:hover ul { +visibility:visible; +} +/* make the fifth level visible when you hover over fourth level link */ +#pmenu li a:hover ul a:hover ul a:hover ul a:hover ul { +visibility:visible; +} +/* make the sixth level visible when you hover over fifth level link */ +#pmenu li a:hover ul a:hover ul a:hover ul a:hover ul a:hover ul { +visibility:visible; +} +/* If you can see the pattern in the above IE5.5 and IE6 style then you can add as many sub levels as you like */ + +@media print { + #menu_container, #hd, #np {display: none;} + #div_teiln {min-width: 20%;} + h1, h2, h3, h4, h5 {color: black;} +} diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/index.css b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/index.css new file mode 100644 index 00000000..2b7cee82 --- /dev/null +++ b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/index.css @@ -0,0 +1,101 @@ + #leftcontent { + position: absolute; + left:10px; + top:120px; + width:210px; + border:0px solid #000; + } + #centercontent { + margin-left: 229px; + margin-right:229px; + margin-top: -2px; + /* + IE5x PC mis-implements the box model. Because of that we sometimes have + to perform a little CSS trickery to get pixel-perfect display across browsers. + The following bit of code was proposed by Tantek Celik, and it preys upon a CSS + parsing bug in IE5x PC that will prematurly close a style rule when it runs + into the string "\"}\"". After that string appears in a rule, then, we can override + previously set attribute values and only browsers without the parse bug will + recognize the new values. So any of the name-value pairs above this comment + that we need to override for browsers with correct box-model implementations + will be listed below. + + We use the voice-family property because it is likely to be used very infrequently, + and where it is used it will be set on the body tag. So the second voice-family value + of "inherit" will override our bogus "\"}\"" value and allow the proper value to + cascade down from the body tag. + + The style rule immediately following this rule offers another chance for CSS2 + aware browsers to pick up the values meant for correct box-model implementations. + It uses a CSS2 selector that will be ignored by IE5x PC. + + Read more at http://www.glish.com/css/hacks.asp + + + voice-family: "\"}\""; + voice-family: inherit; + margin-left: 201px; + margin-right:201px;*/ + } + html>body #centercontent { + margin-left: 231px; + margin-right:231px; + } + #rightcontent { + position: absolute; + right:10px; + top:120px; + width:210px; + } + #banner { + height:120px; + } + html>body #banner { + height:120px; + } + #rightcontent p { + font-size:10px + } + #tabheader { + color : #D6E6F9; + background-color : #6699CC; + font-size : 13px; + font-weight : bold; + padding : 5px; + padding-top:1px; + padding-bottom:1px; + } + #tab { + background-color : #D6E6F9; + margin-top: 2px; + padding : 5px; + } + #navlist { + padding: 0px; + margin: 0px; + width: 100%; + background-color: #6699cc; + } + #navlist li { + list-style: none; + margin: 0; + padding: 0.25em; + padding-top: 0.3em; + padding-bottom: 0.3em; + border-bottom: 1px solid white; + } + a.nb { + font-family:Verdana,Arial,Helv; + font-size:12px; + margin-left:5px; + font-weight:bold; + text-decoration:underline; + color:#D6E6F9; + } + a.nb:hover { + color:white; + } + + @media print { + #rightcontent {display: none;} + } diff --git a/BKUOnline/src/main/webapp/finanzonline/iframe.html b/BKUOnline/src/main/webapp/finanzonline/iframe.html new file mode 100644 index 00000000..ac2f6c93 --- /dev/null +++ b/BKUOnline/src/main/webapp/finanzonline/iframe.html @@ -0,0 +1,22 @@ + + + + bkuiframe + + + + + +
+ Logo + +
+ + +
+
+ + + diff --git a/BKUOnline/src/main/webapp/finanzonline/index.html b/BKUOnline/src/main/webapp/finanzonline/index.html new file mode 100644 index 00000000..d47e8e63 --- /dev/null +++ b/BKUOnline/src/main/webapp/finanzonline/index.html @@ -0,0 +1,192 @@ + + + + FinanzOnline Login + + + + + + + + + + + + + +
+
Login mit Bürgerkarte
+
+ +
+ +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Login mit Zugangskennungen
+ +
+ +
+ +
+ + + + + + +
+ + Online-Erstanmeldung + + Erstanmeldung zu FinanzOnline für Nicht-Unternehmer (nur für Login mit Zugangskennungen nötig) +
+ PIN vergessen / gesperrt + + Online-Rücksetzen auf Start-PIN für Nicht-Unternehmer +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
Service
+ Anonyme Steuerberechnung + + Berechnung der Steuer ohne Anmeldung +
+ + DEMO Arbeitnehmerveranlagung + + + Animierte Anleitung zur Arbeitnehmerveranlagung +
+ + FinanzOnline Ratgeber + + + FinanzOnline in Frage und Antwort +
+ + FinanzOnline eLearning + + + Elektronisches Lernprogramm zur Handhabung von FinanzOnline und Durchführung der Arbeitnehmerveranlagung +
+
+ +
+ +
+ +
+ + + \ No newline at end of file diff --git a/BKUOnline/src/main/webapp/index.html b/BKUOnline/src/main/webapp/index.html index 8f1a338e..bf8b3ae0 100644 --- a/BKUOnline/src/main/webapp/index.html +++ b/BKUOnline/src/main/webapp/index.html @@ -49,6 +49,8 @@

TestRequest

Security Layer Request +

FinanzOnline

+FinanzOnline Demo Integration

STAL Service

STAL Service Endpoint Information

diff --git a/BKUOnline/src/test/resources/appletTest.html b/BKUOnline/src/test/resources/appletTest.html index bf24a2c9..71f09a93 100644 --- a/BKUOnline/src/test/resources/appletTest.html +++ b/BKUOnline/src/test/resources/appletTest.html @@ -22,7 +22,7 @@ width=380 height=160> - + -- cgit v1.2.3 From a8d050168ad30c59087d9b8f7b399f0ffbb671d8 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 9 Oct 2008 07:54:29 +0000 Subject: SimpleGUI (one button) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@88 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/src/test/resources/appletTest.html | 2 +- .../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 2 +- .../java/at/gv/egiz/bku/gui/BKUGUIFactory.java | 32 +- .../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 1451 ++++++++++++++++++++ .../at/gv/egiz/bku/gui/Messages.properties | 4 +- 5 files changed, 1471 insertions(+), 20 deletions(-) create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java (limited to 'BKUApplet') diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html index 3b944a40..5b10d6b5 100644 --- a/BKUApplet/src/test/resources/appletTest.html +++ b/BKUApplet/src/test/resources/appletTest.html @@ -19,7 +19,7 @@
+ width=190 height=130> diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java index 24cc2601..636a9fef 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java @@ -429,7 +429,7 @@ public class BKUGUI implements BKUGUIFacade { JLabel insertCardMsgLabel = new JLabel(); insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - insertCardMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD)); + insertCardMsgLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED)); //MESSAGE_INSERTCARD)); GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java index 478b949b..5124914a 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java @@ -14,19 +14,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package at.gv.egiz.bku.gui; - -public class BKUGUIFactory { - private static BKUGUIFactory instance = new BKUGUIFactory(); - - private BKUGUIFactory() { - } - - protected BKUGUIFacade createNewGUI() { - return new BKUGUI(); - } - - public static BKUGUIFacade createGUI() { - return instance.createNewGUI(); - } -} +package at.gv.egiz.bku.gui; + +public class BKUGUIFactory { + private static BKUGUIFactory instance = new BKUGUIFactory(); + + private BKUGUIFactory() { + } + + protected BKUGUIFacade createNewGUI() { + return new SimpleGUI(); + } + + public static BKUGUIFacade createGUI() { + return instance.createNewGUI(); + } +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java new file mode 100644 index 00000000..b7d86d05 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java @@ -0,0 +1,1451 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package at.gv.egiz.bku.gui; + +import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.stal.HashDataInput; +import java.awt.Color; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.text.MessageFormat; +import java.util.List; +import java.util.Locale; +import java.util.ResourceBundle; +import javax.swing.GroupLayout; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPasswordField; +import javax.swing.JScrollPane; +import javax.swing.JTable; +import javax.swing.JTextArea; +import javax.swing.LayoutStyle; +import javax.swing.SwingUtilities; +import javax.swing.table.TableColumn; +import javax.swing.table.TableModel; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author clemens + */ +public class SimpleGUI implements BKUGUIFacade { + + private static final Log log = LogFactory.getLog(SimpleGUI.class); + public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages"; + public static final String LOGO_RESOURCE = "/images/logo.png"; + public static final String HASHDATA_FONT = "Monospaced"; + public static final Color ERROR_COLOR = Color.RED; + public static final Color HYPERLINK_COLOR = Color.BLUE; + private static final String TITLE_WELCOME = "title.welcome"; + private static final String TITLE_INSERTCARD = "title.insertcard"; + private static final String TITLE_CARD_NOT_SUPPORTED = "title.cardnotsupported"; + private static final String TITLE_CARDPIN = "title.cardpin"; + private static final String TITLE_SIGN = "title.sign"; + private static final String TITLE_ERROR = "title.error"; + private static final String TITLE_RETRY = "title.retry"; + private static final String TITLE_WAIT = "title.wait"; + private static final String TITLE_HASHDATA = "title.hashdata"; + private static final String WINDOWTITLE_SAVE = "windowtitle.save"; + private static final String WINDOWTITLE_SAVEDIR = "windowtitle.savedir"; + private static final String WINDOWTITLE_OVERWRITE = "windowtitle.overwrite"; + private static final String MESSAGE_WAIT = "message.wait"; + private static final String MESSAGE_INSERTCARD = "message.insertcard"; + private static final String MESSAGE_HASHDATALINK = "message.hashdatalink"; + private static final String MESSAGE_HASHDATA = "message.hashdata"; + private static final String MESSAGE_HASHDATALIST = "message.hashdatalist"; + private static final String MESSAGE_RETRIES = "message.retries"; + private static final String MESSAGE_OVERWRITE = "message.overwrite"; + private static final String LABEL_PIN = "label.pin"; + private static final String LABEL_PINSIZE = "label.pinsize"; +// private static final String ERROR_NO_HASHDATA = "error.no.hashdata"; + + private static final String BUTTON_OK = "button.ok"; + private static final String BUTTON_CANCEL = "button.cancel"; + private static final String BUTTON_BACK = "button.back"; + private static final String BUTTON_SIGN = "button.sign"; + private static final String BUTTON_SAVE = "button.save"; + private static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix"; + protected Container contentPane; + protected ResourceBundle messages; + /** left and right side main panels */ +// protected JPanel iconPanel; + protected JPanel contentPanel; + /** right side content panels and layouts */ +// protected JPanel headerPanel; + protected JPanel mainPanel; + protected JPanel buttonPanel; + /** right side fixed labels */ +// protected JLabel titleLabel; + /** remember the pinfield to return to worker */ + protected JPasswordField pinField; + +// protected JButton okButton; +// protected JButton cancelButton; +// protected JButton signButton; +// protected JButton saveButton; +// protected JButton backButton; + protected int buttonSize; + + private static final int CHECKBOX_WIDTH = new JCheckBox().getPreferredSize().width; + + /** + * @param contentPane + * @param localeString may be null + */ + @Override + public void init(final Container contentPane, String localeString) { + + if (localeString != null) { + messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString)); + } else { + messages = ResourceBundle.getBundle(MESSAGES_BUNDLE); + } + + this.contentPane = contentPane; + + try { + + log.debug("scheduling gui initialization"); + + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + + log.debug("initializing gui"); + +// initIconPanel(); + initContentPanel(); + + GroupLayout layout = new GroupLayout(contentPane); + contentPane.setLayout(layout); + layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(contentPanel)); + layout.setVerticalGroup(layout.createSequentialGroup().addComponent(contentPanel)); +// layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) +// .addGroup(layout.createSequentialGroup() +// .addComponent(iconPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); +// layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) +// .addComponent(iconPanel, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) +// .addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); + } + }); + } catch (Exception ex) { + throw new RuntimeException("Failed to init GUI: " + ex.getMessage()); + } + } + +// protected void initIconPanel() { +// iconPanel = new JPanel(); +// JLabel iconLabel = new JLabel(); +// iconLabel.setIcon(new ImageIcon(getClass().getResource(LOGO_RESOURCE))); // NOI18N +// +// GroupLayout iconPanelLayout = new GroupLayout(iconPanel); +// iconPanel.setLayout(iconPanelLayout); +// iconPanelLayout.setHorizontalGroup( +// iconPanelLayout.createSequentialGroup() +// .addContainerGap() +// .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, iconLabel.getPreferredSize().width, GroupLayout.PREFERRED_SIZE) +// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //); +// iconPanelLayout.setVerticalGroup( +// iconPanelLayout.createSequentialGroup() +// .addContainerGap() +// .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, iconLabel.getPreferredSize().height, GroupLayout.PREFERRED_SIZE) +// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //); +// } + + protected void initContentPanel() { + + contentPanel = new JPanel(); + +// headerPanel = new JPanel(); + mainPanel = new JPanel(); + buttonPanel = new JPanel(); + +// headerPanel.setBorder(new TitledBorder("header")); +// mainPanel.setBorder(new TitledBorder("main")); +// buttonPanel.setBorder(new TitledBorder("button")); + +// titleLabel = new JLabel(); +// titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() | +// java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2)); + + JButton b = new JButton(); +// b.setText(messages.getString(BUTTON_CANCEL)); +// if (b.getPreferredSize().width > buttonSize) +// buttonSize = b.getPreferredSize().width; + b.setText(messages.getString(BUTTON_OK)); + if (b.getPreferredSize().width > buttonSize) + buttonSize = b.getPreferredSize().width; + b.setText(messages.getString(BUTTON_SIGN)); + if (b.getPreferredSize().width > buttonSize) + buttonSize = b.getPreferredSize().width; + b.setText(messages.getString(BUTTON_BACK)); + if (b.getPreferredSize().width > buttonSize) + buttonSize = b.getPreferredSize().width; +// b.setText(messages.getString(BUTTON_SAVE)); +// if (b.getPreferredSize().width > buttonSize) +// buttonSize = b.getPreferredSize().width; + +// if (cancelButton.getPreferredSize().width > buttonSize) +// buttonSize = cancelButton.getPreferredSize().width; +// if (signButton.getPreferredSize().width > buttonSize) +// buttonSize = signButton.getPreferredSize().width; +// if (backButton.getPreferredSize().width > buttonSize) +// buttonSize = backButton.getPreferredSize().width; +// if (saveButton.getPreferredSize().width > buttonSize) +// buttonSize = saveButton.getPreferredSize().width; + + +// GroupLayout headerPanelLayout = new GroupLayout(headerPanel); +// headerPanel.setLayout(headerPanelLayout); +// +// headerPanelLayout.setHorizontalGroup( +// headerPanelLayout.createSequentialGroup() +// .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) +// .addContainerGap()); +// headerPanelLayout.setVerticalGroup( +// headerPanelLayout.createSequentialGroup() +// .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); + + + GroupLayout contentPanelLayout = new GroupLayout(contentPanel); + contentPanel.setLayout(contentPanelLayout); +// contentPanelLayout.setHorizontalGroup( +// contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) +// .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) +// .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) +// .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //)); + contentPanelLayout.setHorizontalGroup( + contentPanelLayout.createSequentialGroup() + .addContainerGap() + .addGroup( + contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()); + contentPanelLayout.setVerticalGroup( + contentPanelLayout.createSequentialGroup() + .addContainerGap() +// .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) //, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addContainerGap()); //); + } + + @Override + public void showLoginDialog(ActionListener loginListener, String actionCommand) { + + log.debug("scheduling login dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show login dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + +// titleLabel.setText(messages.getString(TITLE_ERROR)); + + JLabel waitMsgLabel = new JLabel(); + waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + waitMsgLabel.setText("LoginDialog not supported yet."); + waitMsgLabel.setForeground(ERROR_COLOR); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createSequentialGroup() +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(waitMsgLabel)); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(waitMsgLabel)); + + contentPanel.validate(); + } + }); + } + + @Override + public void showWelcomeDialog() { + + log.debug("scheduling welcome dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show welcome dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + +// titleLabel.setText(messages.getString(TITLE_WELCOME)); + + JLabel welcomeMsgLabel = new JLabel(); + welcomeMsgLabel.setFont(welcomeMsgLabel.getFont().deriveFont(welcomeMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + welcomeMsgLabel.setText(messages.getString(TITLE_WELCOME)); //MESSAGE_WAIT)); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createSequentialGroup() +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(welcomeMsgLabel)); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(welcomeMsgLabel)); + + contentPanel.validate(); + + } + }); + } + + @Override + public void showInsertCardDialog(final ActionListener cancelListener, final String cancelCommand) { + + log.debug("scheduling insert card dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show insert card dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + +// titleLabel.setText(messages.getString(TITLE_INSERTCARD)); + + JLabel insertCardMsgLabel = new JLabel(); + insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + insertCardMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD)); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createSequentialGroup() +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(insertCardMsgLabel)); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(insertCardMsgLabel)); + +// JButton cancelButton = new JButton(); +// cancelButton.setText(messages.getString(BUTTON_CANCEL)); +// cancelButton.addActionListener(cancelListener); +// cancelButton.setActionCommand(cancelCommand); +// +// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); +// buttonPanel.setLayout(buttonPanelLayout); +// +// buttonPanelLayout.setHorizontalGroup( +// buttonPanelLayout.createSequentialGroup() +// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) +// .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); +// buttonPanelLayout.setVerticalGroup( +// buttonPanelLayout.createSequentialGroup() +// .addComponent(cancelButton)); + + contentPanel.validate(); + } + }); + } + + /** + * only difference to showInsertCard: title text: card not supported + * @param cancelListener + * @param cancelCommand + */ + @Override + public void showCardNotSupportedDialog(final ActionListener cancelListener, final String cancelCommand) { + + log.debug("scheduling card not supported dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show card not supported dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + +// titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED)); + + JLabel insertCardMsgLabel = new JLabel(); + insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + insertCardMsgLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED)); //MESSAGE_INSERTCARD)); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createSequentialGroup() +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(insertCardMsgLabel)); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(insertCardMsgLabel)); + +// JButton cancelButton = new JButton(); +// cancelButton.setText(messages.getString(BUTTON_CANCEL)); +// cancelButton.addActionListener(cancelListener); +// cancelButton.setActionCommand(cancelCommand); +// +// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); +// buttonPanel.setLayout(buttonPanelLayout); +// +// buttonPanelLayout.setHorizontalGroup( +// buttonPanelLayout.createSequentialGroup() +// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) +// .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); +// buttonPanelLayout.setVerticalGroup( +// buttonPanelLayout.createSequentialGroup() +// .addComponent(cancelButton)); + + contentPanel.validate(); + } + }); + } + + private void showCardPINDialog(final PINSpec pinSpec, final int numRetries, final ActionListener okListener, final String okCommand, final ActionListener cancelListener, final String cancelCommand) { + + log.debug("scheduling card-pin dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show card-pin dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + +// if (numRetries < 0) { +// String cardpinTitle = messages.getString(TITLE_CARDPIN); +// titleLabel.setText(MessageFormat.format(cardpinTitle, new Object[]{pinSpec.getLocalizedName()})); +// } else { +// titleLabel.setText(messages.getString(TITLE_RETRY)); +// } + +// JButton cancelButton = new JButton(); +// cancelButton.setText(messages.getString(BUTTON_CANCEL)); +// cancelButton.setActionCommand(cancelCommand); +// cancelButton.addActionListener(cancelListener); + + JButton okButton = new JButton(); + okButton.setText(messages.getString(BUTTON_OK)); + okButton.setEnabled(false); + okButton.setActionCommand(okCommand); + okButton.addActionListener(okListener); + + JLabel cardPinLabel = new JLabel(); + cardPinLabel.setFont(cardPinLabel.getFont().deriveFont(cardPinLabel.getFont().getStyle() | java.awt.Font.BOLD)); + String pinLabel = messages.getString(LABEL_PIN); + cardPinLabel.setText(MessageFormat.format(pinLabel, new Object[]{pinSpec.getLocalizedName()})); + +// JPasswordField cardPINField = new JPasswordField(); + pinField = new JPasswordField(); + pinField.setText(""); + pinField.setDocument(new PINDocument(pinSpec, okButton)); + pinField.setActionCommand(okCommand); + pinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (pinField.getPassword().length >= pinSpec.getMinLength()) { + okListener.actionPerformed(e); + } + } + }); + + JLabel infoLabel = new JLabel(); + if (numRetries < 0) { + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + String pinsizePattern = messages.getString(LABEL_PINSIZE); + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); + } + infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); + } else { + infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); + infoLabel.setForeground(ERROR_COLOR); + } + +// GroupLayout mainPanelLayout = new GroupLayout(mainPanel); +// mainPanel.setLayout(mainPanelLayout); +// +// mainPanelLayout.setHorizontalGroup( +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) +// .addGroup(mainPanelLayout.createSequentialGroup() // .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) +// // .addComponent(hashDataLabel) +// // .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() +// .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) //RELATED) +// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) //TRAILING) +// .addComponent(infoLabel) //, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE) +// .addComponent(pinField, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)) //)) +// .addContainerGap())); +// +// mainPanelLayout.setVerticalGroup( +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addContainerGap() // .addComponent(hashDataLabel).addGap(14, 14, 14) +// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) //, false) +// .addComponent(cardPinLabel) //, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) +// .addComponent(pinField)) //, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(infoLabel).addGap(cardPinLabel.getFont().getSize()))); //10, 10, 10))); +// +// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); +// buttonPanel.setLayout(buttonPanelLayout); +// +// buttonPanelLayout.setHorizontalGroup( +// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE).addComponent(okButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton).addContainerGap())); +// buttonPanelLayout.setVerticalGroup( +// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(okButton).addComponent(cancelButton))); + + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) //)) + .addComponent(infoLabel)); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() +// .addComponent(hashDataLabel) +// .addGap(hashDataLabel.getFont().getSize()) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(cardPinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(infoLabel)); +// .addGap(signPinLabel.getFont().getSize())); + + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createSequentialGroup() + .addComponent(okButton)); + +// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); +// buttonPanel.setLayout(buttonPanelLayout); +// +// buttonPanelLayout.setHorizontalGroup( +// buttonPanelLayout.createSequentialGroup() +// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) +// .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); +// buttonPanelLayout.setVerticalGroup( +// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) +// .addComponent(okButton) +// .addComponent(cancelButton)); + + pinField.requestFocusInWindow(); + contentPanel.validate(); + + } + }); + } + + @Override + public void showCardPINDialog(PINSpec pinSpec, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand) { + showCardPINDialog(pinSpec, -1, okListener, okCommand, cancelListener, cancelCommand); + } + + @Override + public void showCardPINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand) { + showCardPINDialog(pinSpec, numRetries, okListener, okCommand, cancelListener, cancelCommand); + } + + @Override + public void showSignaturePINDialog(PINSpec pinSpec, ActionListener signListener, String signCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand) { + showSignaturePINDialog(pinSpec, -1, signListener, signCommand, cancelListener, cancelCommand, hashdataListener, hashdataCommand); + } + + @Override + public void showSignaturePINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand) { + showSignaturePINDialog(pinSpec, numRetries, okListener, okCommand, cancelListener, cancelCommand, hashdataListener, hashdataCommand); + } + + private void showSignaturePINDialog(final PINSpec pinSpec, final int numRetries, final ActionListener signListener, final String signCommand, final ActionListener cancelListener, final String cancelCommand, final ActionListener hashdataListener, final String hashdataCommand) { + + log.debug("scheduling signature-pin dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show signature-pin dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + +// if (numRetries < 0) { +// titleLabel.setText(messages.getString(TITLE_SIGN)); +// } else { +// titleLabel.setText(messages.getString(TITLE_RETRY)); +// } + +// JButton cancelButton = new JButton(); +// cancelButton.setText(messages.getString(BUTTON_CANCEL)); +// cancelButton.setActionCommand(cancelCommand); +// cancelButton.addActionListener(cancelListener); + + JButton signButton = new JButton(); + signButton.setText(messages.getString(BUTTON_SIGN)); + signButton.setEnabled(false); + signButton.setActionCommand(signCommand); + signButton.addActionListener(signListener); + + JLabel signPinLabel = new JLabel(); + signPinLabel.setFont(signPinLabel.getFont().deriveFont(signPinLabel.getFont().getStyle() | java.awt.Font.BOLD)); + String pinLabel = messages.getString(LABEL_PIN); + signPinLabel.setText(MessageFormat.format(pinLabel, new Object[]{pinSpec.getLocalizedName()})); + + pinField = new JPasswordField(); + pinField.setText(""); + pinField.setDocument(new PINDocument(pinSpec, signButton)); + pinField.setActionCommand(signCommand); + pinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (pinField.getPassword().length >= pinSpec.getMinLength()) { + signListener.actionPerformed(e); + } + } + }); + + //pinsize or error label + JLabel infoLabel = new JLabel(); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + if (numRetries < 0) { + String pinsizePattern = messages.getString(LABEL_PINSIZE); + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); + } + infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); + } else { + infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); + infoLabel.setForeground(ERROR_COLOR); + } + + JLabel hashDataLabel = new JLabel(); + hashDataLabel.setFont(hashDataLabel.getFont().deriveFont(hashDataLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + hashDataLabel.setText(messages.getString(MESSAGE_HASHDATALINK)); + hashDataLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + hashDataLabel.setForeground(HYPERLINK_COLOR); + hashDataLabel.addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent me) { + ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand); + hashdataListener.actionPerformed(e); + } + }); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(hashDataLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() + .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(infoLabel)); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addComponent(hashDataLabel) + .addGap(hashDataLabel.getFont().getSize()) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(signPinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(infoLabel)); +// .addGap(signPinLabel.getFont().getSize())); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(signButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createSequentialGroup() + .addComponent(signButton)); + +// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); +// buttonPanel.setLayout(buttonPanelLayout); +// +// buttonPanelLayout.setHorizontalGroup( +// buttonPanelLayout.createSequentialGroup() +// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) +// .addComponent(signButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); +// buttonPanelLayout.setVerticalGroup( +// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) +// .addComponent(signButton) +// .addComponent(cancelButton)); + + pinField.requestFocusInWindow(); + contentPanel.validate(); + + }// private ParallelGroup createMainGroup(GroupLayout mainPanelLayout, JLabel hashDataLabel, JLabel signPinLabel, JLabel pinSizeLabel, JLabel errorLabel) { +// ParallelGroup mainGroup = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); +// mainGroup.addComponent(hashDataLabel); +// if (errorLabel != null) { +// mainGroup.addComponent(errorLabel); +// } +// mainGroup.addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() +// .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) +// .addComponent(pinSizeLabel) +// .addComponent(pinField, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE))); +// return mainGroup; +// } +// private GroupLayout.SequentialGroup createVerticalMainGroup(GroupLayout mainPanelLayout, JLabel hashDataLabel, JLabel signPinLabel, JLabel pinSizeLabel, JLabel errorLabel) { +// GroupLayout.SequentialGroup mainGroup = mainPanelLayout.createSequentialGroup(); +// mainGroup.addComponent(hashDataLabel) +// .addGap(hashDataLabel.getFont().getSize()); //14, 14, 14) +// +// if (errorLabel != null) { +// mainGroup.addComponent(errorLabel) +// .addGap(errorLabel.getFont().getSize()); +// } +// mainGroup.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE, false) +// .addComponent(signPinLabel) //, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) +// .addComponent(pinField)) //, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(pinSizeLabel) +// .addGap(signPinLabel.getFont().getSize()); +// +// return mainGroup; +//// mainPanelLayout.createSequentialGroup() +//// .addComponent(hashDataLabel) +//// .addGap(hashDataLabel.getFont().getSize()) //14, 14, 14) +//// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE, false) +//// .addComponent(signPinLabel) //, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE) +//// .addComponent(pinField)) //, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE)) +//// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +//// .addComponent(pinSizeLabel) +//// .addGap(signPinLabel.getFont().getSize()) +//// +//// +// } + }); + } + + @Override + public void showErrorDialog(final String errorMsgKey, final Object[] errorMsgParams, final ActionListener okListener, final String okCommand) { + + log.debug("scheduling error dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show error dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + +// titleLabel.setText(messages.getString(TITLE_ERROR)); + + String errorMsgPattern = messages.getString(errorMsgKey); + String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams); + + JLabel errorMsgLabel = new JLabel(); + errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + errorMsgLabel.setText(errorMsg); + errorMsgLabel.setForeground(ERROR_COLOR); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createSequentialGroup() +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(errorMsgLabel)); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(errorMsgLabel)); + + JButton okButton = new JButton(); + okButton.setText(messages.getString(BUTTON_OK)); + okButton.setActionCommand(okCommand); + okButton.addActionListener(okListener); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createSequentialGroup() + .addComponent(okButton)); + + contentPanel.validate(); + } + }); + } + + @Override + public void showErrorDialog(final String errorMsgKey, final Object[] errorMsgParams) { + + log.debug("scheduling error dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show error dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + +// titleLabel.setText(messages.getString(TITLE_ERROR)); + + String errorMsgPattern = messages.getString(errorMsgKey); + String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams); + + JLabel errorMsgLabel = new JLabel(); + errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + errorMsgLabel.setText(errorMsg); + errorMsgLabel.setForeground(ERROR_COLOR); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createSequentialGroup() +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(errorMsgLabel)); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(errorMsgLabel)); + + contentPanel.validate(); + } + }); + } + + @Override + public void showWaitDialog(final String waitMessage) { + + log.debug("scheduling wait dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show wait dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + +// titleLabel.setText(messages.getString(TITLE_WAIT)); + + JLabel waitMsgLabel = new JLabel(); + waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + if (waitMessage != null) { + waitMsgLabel.setText("" + waitMessage + ""); + } else { + waitMsgLabel.setText(messages.getString(MESSAGE_WAIT)); + } + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createSequentialGroup() +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(waitMsgLabel)); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(waitMsgLabel)); + + contentPanel.validate(); + } + }); + } + + @Override + public char[] getPin() { + if (pinField != null) { + return pinField.getPassword(); + } + return null; + } + + @Override + public void showHashDataInputDialog(final List signedReferences, final ActionListener okListener, final String okCommand) { + + if (signedReferences == null) { + showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {"No SignedReferences provided"}, okListener, okCommand); + } + + if (signedReferences.size() == 1) { + +// final HashDataInput signedRef = signedReferences.get(0); + + if ("text/plain".equals(signedReferences.get(0).getMimeType())) { + + ActionListener saveHashDataListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + showSaveHashDataInputDialog(signedReferences, okListener, okCommand); + } + }; + + try { + String hashDataText = getText(signedReferences.get(0)); + showPlainTextHashDataInputDialog(hashDataText, saveHashDataListener, "save", okListener, okCommand); + } catch (IOException ex) { + showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {ex.getMessage()}, okListener, okCommand); + } + + } else { + showSaveHashDataInputDialog(signedReferences, okListener, okCommand); + } + + } else { + + final HashDataTableModel tableModel = new HashDataTableModel(signedReferences); + + ActionListener saveHashDataListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + showSaveHashDataInputDialog(tableModel.getSelectedHashData(), okListener, okCommand); + } + }; + showMultipleHashDataInputDialog(tableModel, okListener, okCommand, saveHashDataListener, "save"); + } + } + + private void showPlainTextHashDataInputDialog(final String hashDataText, final ActionListener saveListener, final String saveCommand, final ActionListener cancelListener, final String cancelCommand) { + + log.debug("scheduling plaintext hashdatainput dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show plaintext hashdatainput dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + +// titleLabel.setText(messages.getString(TITLE_HASHDATA)); + + JLabel refIdLabel = new JLabel(); + refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + refIdLabel.setText(messages.getString(MESSAGE_HASHDATA)); //MessageFormat.format(refIdLabelPattern, new Object[]{refId})); + + JTextArea hashDataTextArea = new JTextArea(hashDataText); + hashDataTextArea.setEditable(false); +// hashDataTextArea.setColumns(1); +// hashDataTextArea.setRows(1); + hashDataTextArea.setFont(new Font(HASHDATA_FONT, hashDataTextArea.getFont().getStyle(), hashDataTextArea.getFont().getSize())); +// hashDataScrollPane.setViewportView(hashDataTextArea); +// hashDataScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); //HORIZONTAL_SCROLLBAR_NEVER); + hashDataTextArea.setLineWrap(true); + hashDataTextArea.setWrapStyleWord(true); + + JScrollPane hashDataScrollPane = new JScrollPane(hashDataTextArea); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(refIdLabel) + .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addComponent(refIdLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); + + // GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + // mainPanel.setLayout(mainPanelLayout); + // + // mainPanelLayout.setHorizontalGroup( + // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(refIdLabel).addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)).addContainerGap())); + // + // mainPanelLayout.setVerticalGroup( + // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addComponent(refIdLabel).addGap(refIdLabel.getFont().getSize()).addComponent(hashDataScrollPane).addGap(refIdLabel.getFont().getSize()))); + + JButton backButton = new JButton(); + backButton.setText(messages.getString(BUTTON_BACK)); + backButton.setActionCommand(cancelCommand); + backButton.addActionListener(cancelListener); + +// JButton saveButton = new JButton(); +// saveButton.setText(messages.getString(BUTTON_SAVE)); +// saveButton.setActionCommand(saveCommand); +// saveButton.addActionListener(saveListener); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createSequentialGroup() + .addComponent(backButton)); + +// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); +// buttonPanel.setLayout(buttonPanelLayout); +// +// buttonPanelLayout.setHorizontalGroup( +// buttonPanelLayout.createSequentialGroup() +// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) +// .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); +// buttonPanelLayout.setVerticalGroup( +// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) +// .addComponent(saveButton) +// .addComponent(backButton)); + + + // GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + // buttonPanel.setLayout(buttonPanelLayout); + // + // buttonPanelLayout.setHorizontalGroup( + // buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE).addComponent(saveButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton).addContainerGap())); + // buttonPanelLayout.setVerticalGroup( + // buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(saveButton).addComponent(cancelButton))); + + contentPanel.validate(); + } + }); + } + + private void showMultipleHashDataInputDialog(final TableModel signedReferences, final ActionListener cancelListener, final String cancelCommand, final ActionListener saveListener, final String saveCommand) { + + log.debug("scheduling multiple hashdatainput dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show multiple hashdatainput dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + +// titleLabel.setText(messages.getString(TITLE_HASHDATA)); + + JLabel refIdLabel = new JLabel(); + refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + String refIdLabelPattern = messages.getString(MESSAGE_HASHDATALIST); + refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.getRowCount()})); + + JTable hashDataTable = new JTable(); + hashDataTable.setModel(signedReferences); + hashDataTable.setTableHeader(null); + // hashDataTable.setShowVerticalLines(false); + // hashDataTable.setRowSelectionAllowed(false); + TableColumn selectCol = hashDataTable.getColumnModel().getColumn(1); + selectCol.setMinWidth(CHECKBOX_WIDTH); + selectCol.setMaxWidth(CHECKBOX_WIDTH); + + +// hashDataTable.setPreferredScrollableViewportSize(mainPanel.getPreferredSize()); + + JScrollPane hashDataScrollPane = new JScrollPane(hashDataTable); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(refIdLabel) + .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addComponent(refIdLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(hashDataScrollPane, 0, 0, hashDataTable.getPreferredSize().height+3)); + // .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)); + + + + // + // GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + // mainPanel.setLayout(mainPanelLayout); + // + // mainPanelLayout.setHorizontalGroup( + // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + // .addGroup(mainPanelLayout.createSequentialGroup() + // .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + // .addComponent(refIdLabel) + // .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)) + // .addContainerGap())); + // + // mainPanelLayout.setVerticalGroup( + // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + // .addGroup(mainPanelLayout.createSequentialGroup() + // .addComponent(refIdLabel) + // .addGap(refIdLabel.getFont().getSize()) + // .addComponent(hashDataScrollPane) + // .addGap(refIdLabel.getFont().getSize()))); + + + + + + + + + + + + + // GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + // buttonPanel.setLayout(buttonPanelLayout); + // + // buttonPanelLayout.setHorizontalGroup( + // buttonPanelLayout.createSequentialGroup() + //// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + //// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup() + // .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + // .addComponent(saveButton) + // .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + // .addComponent(cancelButton) + // .addContainerGap()); //); + // buttonPanelLayout.setVerticalGroup( + // buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + // .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup() + // .addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + // .addComponent(saveButton) + // .addComponent(cancelButton)) + // .addContainerGap())); + + + JButton backButton = new JButton(); + backButton.setText(messages.getString(BUTTON_BACK)); + backButton.setActionCommand(cancelCommand); + backButton.addActionListener(cancelListener); + +// JButton saveButton = new JButton(); +// saveButton.setText(messages.getString(BUTTON_SAVE)); +// saveButton.setActionCommand(saveCommand); +// saveButton.addActionListener(saveListener); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createSequentialGroup() + .addComponent(backButton)); + + +// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); +// buttonPanel.setLayout(buttonPanelLayout); +// +// buttonPanelLayout.setHorizontalGroup( +// buttonPanelLayout.createSequentialGroup() +// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) +// .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); +// buttonPanelLayout.setVerticalGroup( +// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) +// .addComponent(saveButton) +// .addComponent(backButton)); + + contentPanel.validate(); + } + }); + } + +// private DisposableFileChooser fileDialog; + + private void showSaveHashDataInputDialog(final List signedRefs, final ActionListener okListener, final String okCommand) { + + log.debug("scheduling save hashdatainput dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show save hashdatainput dialog"); + + String userHome = System.getProperty("user.home"); + + JFileChooser fileDialog = new JFileChooser(userHome); + fileDialog.setMultiSelectionEnabled(false); + fileDialog.setDialogType(JFileChooser.SAVE_DIALOG); + fileDialog.setFileHidingEnabled(true); + if (signedRefs.size() == 1) { + fileDialog.setDialogTitle(messages.getString(WINDOWTITLE_SAVE)); + fileDialog.setFileSelectionMode(JFileChooser.FILES_ONLY); + String mimeType = signedRefs.get(0).getMimeType(); + MimeFilter mimeFilter = new MimeFilter(mimeType, messages); + fileDialog.setFileFilter(mimeFilter); + String filename = messages.getString(SAVE_HASHDATAINPUT_PREFIX) + MimeFilter.getExtension(mimeType); + fileDialog.setSelectedFile(new File(userHome, filename)); + } else { + fileDialog.setDialogTitle(messages.getString(WINDOWTITLE_SAVEDIR)); + fileDialog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + } + + //parent contentPane -> placed over applet + switch (fileDialog.showSaveDialog(fileDialog)) { + case JFileChooser.APPROVE_OPTION: + File f = fileDialog.getSelectedFile(); + for (HashDataInput hashDataInput : signedRefs) { + String mimeType = hashDataInput.getMimeType(); + String id = hashDataInput.getReferenceId(); + File file; + if (f.isDirectory()) { + String filename = messages.getString(SAVE_HASHDATAINPUT_PREFIX) + '_' + id + MimeFilter.getExtension(mimeType); + file = new File(f, filename); + } else { + file = f; + } + if (file.exists()) { + String ovrwrt = messages.getString(MESSAGE_OVERWRITE); + int overwrite = JOptionPane.showConfirmDialog(fileDialog, MessageFormat.format(ovrwrt, file), messages.getString(WINDOWTITLE_OVERWRITE), JOptionPane.OK_CANCEL_OPTION); + if (overwrite != JOptionPane.OK_OPTION) { + continue; + } + } + if (log.isDebugEnabled()) { + log.debug("Writing HashDataInput " + id + " (" + mimeType + ") to file " + file); + } + FileOutputStream fos = null; + try { + fos = new FileOutputStream(file); + BufferedOutputStream bos = new BufferedOutputStream(fos); + InputStream hdi = hashDataInput.getHashDataInput(); + int b; + while ((b = hdi.read()) != -1) { + bos.write(b); + } + bos.flush(); + bos.close(); + } catch (IOException ex) { + log.error("Failed to write HashDataInput to file " + file + ": " + ex.getMessage()); + showErrorDialog(ERR_WRITE_HASHDATA, new Object[] {ex.getMessage()}, null, null); + ex.printStackTrace(); + } finally { + try { + fos.close(); + } catch (IOException ex) { + } + } + } + } + log.debug("done saving hashdatainput"); + okListener.actionPerformed(new ActionEvent(fileDialog, ActionEvent.ACTION_PERFORMED, okCommand)); + } + }); + } + + private static String getText(HashDataInput hdi) throws IOException { + ByteArrayOutputStream baos = null; + try { + InputStream hashDataIS = hdi.getHashDataInput(); + if (hashDataIS == null) { + log.error("No HashDataInput stream for reference " + hdi.getReferenceId()); + return null; + } else { + baos = new ByteArrayOutputStream(hashDataIS.available()); + int c; + while ((c = hashDataIS.read()) != -1) { + baos.write(c); + } + String encoding = hdi.getEncoding(); + if (encoding == null) { + //default for URL-encoded + encoding = "UTF-8"; + } + return baos.toString(encoding); + } + } catch (IOException ex) { + log.error("Failed to read HashDataInput for reference " + hdi.getReferenceId() + ": " + ex.getMessage()); + throw ex; + } finally { + try { + baos.close(); + } catch (IOException ex) { + } + } + } + +// private String parseToken(final char[] terminators) { +// char ch; +// i1 = pos; +// i2 = pos; +// while (hasChar()) { +// ch = chars[pos]; +// if (isOneOf(ch, terminators)) { +// break; +// } +// i2++; +// pos++; +// } +// return getToken(false); +// } + +// private static String getCharset(String contentType) { +// +// StringTokenizer t = new StringTokenizer +// +// if (contentType == null) { +// return "UTF-8"; +// } +// +// int pos = 0; +// int len = contentType.length(); +// +// while (pos < len) { +// pos++; +// String paramName = parseToken(new char[] { +// '=', separator }); +// } +// +// HashMap params = new HashMap(); +// this.chars = chars; +// this.pos = offset; +// this.len = length; +// +// String paramName = null; +// String paramValue = null; +// while (hasChar()) { +// paramName = parseToken(new char[] { +// '=', separator }); +// paramValue = null; +// if (hasChar() && (chars[pos] == '=')) { +// pos++; // skip '=' +// paramValue = parseQuotedToken(new char[] { +// separator }); +// } +// if (hasChar() && (chars[pos] == separator)) { +// pos++; // skip separator +// } +// if ((paramName != null) && (paramName.length() > 0)) { +// if (this.lowerCaseNames) { +// paramName = paramName.toLowerCase(); +// } +// params.put(paramName, paramValue); +// } +// } +// return params; +// +// +// +// Parser +// ParameterParser pf = new ParameterParser(); +// pf.setLowerCaseNames(true); +// Map map = pf.parse(contentType, SEPERATOR); +// String retVal = (String) map.get(CHAR_SET); +// if ((retVal == null) && (replaceNullWithDefault)) { +// if (map.containsKey(APPLICATION_URL_ENCODED)) { +// // default charset for url encoded data +// return "UTF-8"; +// } +// retVal = getDefaultCharset(); +// } +// return retVal; +// } + +} diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index 79e23859..a2b5e0df 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -28,10 +28,10 @@ windowtitle.overwrite=Datei \u00FCberschreiben? message.wait=Bitte warten... message.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken message.hashdatalink=Signaturdaten anzeigen... -message.hashdata=Ein textuelles Signaturdatenobjekt: +message.hashdata=Ein Signaturdatenobjekt: #message.hashdata=Referenz Id: {0} message.hashdatalist={0} Signaturdatenobjekte: -message.retries=Noch {0} Versuche +message.retries=Noch {0} Versuch(e) message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben? label.pin={0}: label.pinsize=({0} stellig) -- cgit v1.2.3 From f993d336e51b9f7898aeeff2e5ae6785066d1e5b Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 9 Oct 2008 16:23:52 +0000 Subject: demo integration beta1 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@94 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/hs_err_pid32072.log | 453 +++++++++++++++++++++ .../at/gv/egiz/bku/online/applet/BKUApplet.java | 17 +- .../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 7 +- .../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 3 +- .../main/java/at/gv/egiz/bku/gui/ImagePanel.java | 37 ++ .../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 38 +- .../at/gv/egiz/bku/gui/Messages.properties | 2 +- BKUCommonGUI/src/main/resources/images/mocca.png | Bin 0 -> 1450 bytes .../src/main/resources/images/mocca_default.png | Bin 0 -> 1287 bytes .../src/main/resources/images/mocca_tiny.png | Bin 0 -> 1025 bytes .../test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 2 +- BKUOnline/src/main/webapp/META-INF/context.xml | 1 + BKUOnline/src/main/webapp/appletPage.jsp | 2 +- BKUOnline/src/main/webapp/index.html | 2 - 14 files changed, 542 insertions(+), 22 deletions(-) create mode 100644 BKUApplet/hs_err_pid32072.log create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java create mode 100644 BKUCommonGUI/src/main/resources/images/mocca.png create mode 100644 BKUCommonGUI/src/main/resources/images/mocca_default.png create mode 100644 BKUCommonGUI/src/main/resources/images/mocca_tiny.png (limited to 'BKUApplet') diff --git a/BKUApplet/hs_err_pid32072.log b/BKUApplet/hs_err_pid32072.log new file mode 100644 index 00000000..cf86d1c5 --- /dev/null +++ b/BKUApplet/hs_err_pid32072.log @@ -0,0 +1,453 @@ +# +# An unexpected error has been detected by Java Runtime Environment: +# +# SIGBUS (0x7) at pc=0xb7bcbc53, pid=32072, tid=3033660304 +# +# Java VM: Java HotSpot(TM) Client VM (10.0-b22 mixed mode, sharing linux-x86) +# Problematic frame: +# C [libzip.so+0xbc53] +# +# If you would like to submit a bug report, please visit: +# http://java.sun.com/webapps/bugreport/crash.jsp +# The crash happened outside the Java Virtual Machine in native code. +# See problematic frame for where to report the bug. +# + +--------------- T H R E A D --------------- + +Current thread (0xb4faa400): JavaThread "Thread-2" [_thread_in_native, id=32091, stack(0xb4ccf000,0xb4d20000)] + +siginfo:si_signo=SIGBUS: si_errno=0, si_code=2 (BUS_ADRERR), si_addr=0xb5804fc0 + +Registers: +EAX=0x080576a8, EBX=0xb7bd07bc, ECX=0xb5803000, EDX=0x0002d000 +ESP=0xb4d1dc10, EBP=0xb4d1dc38, ESI=0xb5804fa3, EDI=0x0839b310 +EIP=0xb7bcbc53, CR2=0xb5804fc0, EFLAGS=0x00210286 + +Top of Stack: (sp=0xb4d1dc10) +0xb4d1dc10: 00000030 b4fa9370 b4fa9378 b4fa9764 +0xb4d1dc20: 08057568 08057568 b7bcbc0b b7bd07bc +0xb4d1dc30: 0828f3cc 00000000 b4d1dc68 b7bcc00b +0xb4d1dc40: 080576a8 0828f3cc 00000000 00000000 +0xb4d1dc50: b4faa400 00000004 87c67713 b7bd07bc +0xb4d1dc60: b4d1dcb0 b4faa4f4 b4d1e0d8 b7bc31b9 +0xb4d1dc70: 080576a8 b4d1dcb0 00000025 00000025 +0xb4d1dc80: b4d1dcb0 6c706d69 49554765 2e303124 + +Instructions: (pc=0xb7bcbc53) +0xb7bcbc43: 8b 70 04 8b 45 08 8b 48 10 8b 50 1c 01 ce 29 d6 +0xb7bcbc53: 0f b6 46 1d 0f b6 56 1c c1 e0 08 09 c2 89 55 f0 + +Stack: [0xb4ccf000,0xb4d20000], sp=0xb4d1dc10, free space=315k +Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) +C [libzip.so+0xbc53] +C [libzip.so+0xc00b] ZIP_GetEntry+0x10b +C [libzip.so+0x31b9] Java_java_util_zip_ZipFile_getEntry+0xc9 +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +J sun.misc.URLClassPath$JarLoader.getResource(Ljava/lang/String;Z)Lsun/misc/Resource; +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::StubRoutines (1) +V [libjvm.so+0x21c5cd] +V [libjvm.so+0x310748] +V [libjvm.so+0x21c460] +V [libjvm.so+0x272313] +C [libjava.so+0xaa5c] Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2+0x3c +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::StubRoutines (1) +V [libjvm.so+0x21c5cd] +V [libjvm.so+0x310748] +V [libjvm.so+0x21c0f1] +V [libjvm.so+0x21c1da] +V [libjvm.so+0x375867] +V [libjvm.so+0x374305] +V [libjvm.so+0x373377] +V [libjvm.so+0x373082] +V [libjvm.so+0x1bc043] +V [libjvm.so+0x20c8e6] +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::StubRoutines (1) +V [libjvm.so+0x21c5cd] +V [libjvm.so+0x310748] +V [libjvm.so+0x21bee0] +V [libjvm.so+0x21bf6d] +V [libjvm.so+0x28c175] +V [libjvm.so+0x391f8d] +V [libjvm.so+0x3113f9] +C [libpthread.so.0+0x54fb] + +Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +J sun.misc.URLClassPath$JarLoader.getResource(Ljava/lang/String;Z)Lsun/misc/Resource; +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::StubRoutines (1) +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::StubRoutines (1) +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::Interpreter +v ~BufferBlob::StubRoutines (1) + +--------------- P R O C E S S --------------- + +Java Threads: ( => current thread ) + 0xb5702400 JavaThread "Thread-3" [_thread_blocked, id=32217, stack(0xb4c7e000,0xb4ccf000)] +=>0xb4faa400 JavaThread "Thread-2" [_thread_in_native, id=32091, stack(0xb4ccf000,0xb4d20000)] + 0x0828e400 JavaThread "AWT-EventQueue-1" [_thread_blocked, id=32089, stack(0xb4eaf000,0xb4f00000)] + 0xb57b9400 JavaThread "TimerQueue" daemon [_thread_blocked, id=32088, stack(0xb4dd5000,0xb4e26000)] + 0xb4f8a400 JavaThread "DestroyJavaVM" [_thread_blocked, id=32073, stack(0xb7c43000,0xb7c94000)] + 0xb57a1400 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=32086, stack(0xb507f000,0xb50d0000)] + 0xb57a0800 JavaThread "AWT-Shutdown" [_thread_blocked, id=32085, stack(0xb50d0000,0xb5121000)] + 0xb5792000 JavaThread "AWT-XAWT" daemon [_thread_in_native, id=32082, stack(0xb520c000,0xb525d000)] + 0xb5751000 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=32081, stack(0xb5285000,0xb52d6000)] + 0xb5700c00 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=32079, stack(0xb5823000,0xb5874000)] + 0x0808c000 JavaThread "CompilerThread0" daemon [_thread_blocked, id=32078, stack(0xb5874000,0xb58f5000)] + 0x0808ac00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=32077, stack(0xb58f5000,0xb5946000)] + 0x08081c00 JavaThread "Finalizer" daemon [_thread_blocked, id=32076, stack(0xb598c000,0xb59dd000)] + 0x08080c00 JavaThread "Reference Handler" daemon [_thread_blocked, id=32075, stack(0xb59dd000,0xb5a2e000)] + +Other Threads: + 0x0807f400 VMThread [stack: 0xb5a2e000,0xb5aaf000] [id=32074] + 0xb570a400 WatcherThread [stack: 0xb567f000,0xb5700000] [id=32080] + +VM state:not at safepoint (normal execution) + +VM Mutex/Monitor currently owned by a thread: None + +Heap + def new generation total 960K, used 512K [0x8bfe0000, 0x8c0e0000, 0x8c4c0000) + eden space 896K, 50% used [0x8bfe0000, 0x8c050378, 0x8c0c0000) + from space 64K, 100% used [0x8c0d0000, 0x8c0e0000, 0x8c0e0000) + to space 64K, 0% used [0x8c0c0000, 0x8c0c0000, 0x8c0d0000) + tenured generation total 4096K, used 3837K [0x8c4c0000, 0x8c8c0000, 0x8ffe0000) + the space 4096K, 93% used [0x8c4c0000, 0x8c87f6a0, 0x8c87f800, 0x8c8c0000) + compacting perm gen total 12288K, used 6940K [0x8ffe0000, 0x90be0000, 0x93fe0000) + the space 12288K, 56% used [0x8ffe0000, 0x906a7308, 0x906a7400, 0x90be0000) + ro space 8192K, 73% used [0x93fe0000, 0x945c34a0, 0x945c3600, 0x947e0000) + rw space 12288K, 58% used [0x947e0000, 0x94ed8668, 0x94ed8800, 0x953e0000) + +Dynamic libraries: +06000000-0641b000 r-xp 00000000 08:02 1085428 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/libjvm.so +0641b000-06435000 rwxp 0041a000 08:02 1085428 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/libjvm.so +06435000-06855000 rwxp 06435000 00:00 0 +08048000-08052000 r-xp 00000000 08:02 1085534 /usr/lib/jvm/java-6-sun-1.6.0.06/bin/appletviewer +08052000-08053000 rwxp 00009000 08:02 1085534 /usr/lib/jvm/java-6-sun-1.6.0.06/bin/appletviewer +08053000-083f5000 rwxp 08053000 00:00 0 [heap] +8bfe0000-8c0e0000 rwxp 8bfe0000 00:00 0 +8c0e0000-8c4c0000 rwxp 8c0e0000 00:00 0 +8c4c0000-8c8c0000 rwxp 8c4c0000 00:00 0 +8c8c0000-8ffe0000 rwxp 8c8c0000 00:00 0 +8ffe0000-90be0000 rwxp 8ffe0000 00:00 0 +90be0000-93fe0000 rwxp 90be0000 00:00 0 +93fe0000-945c4000 r-xs 00001000 08:02 1081430 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/classes.jsa +945c4000-947e0000 rwxp 945c4000 00:00 0 +947e0000-94ed9000 rwxp 005e5000 08:02 1081430 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/classes.jsa +94ed9000-953e0000 rwxp 94ed9000 00:00 0 +953e0000-954b9000 rwxp 00cde000 08:02 1081430 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/classes.jsa +954b9000-957e0000 rwxp 954b9000 00:00 0 +957e0000-957e4000 r-xs 00db7000 08:02 1081430 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/classes.jsa +957e4000-95be0000 rwxp 957e4000 00:00 0 +b4c7e000-b4c81000 ---p b4c7e000 00:00 0 +b4c81000-b4ccf000 rwxp b4c81000 00:00 0 +b4ccf000-b4cd2000 ---p b4ccf000 00:00 0 +b4cd2000-b4d20000 rwxp b4cd2000 00:00 0 +b4d20000-b4d23000 r-xs 00000000 08:02 3560016 /var/cache/fontconfig/5e10083637a12ecd1bff191eb66bfa2f-x86.cache-2 +b4d23000-b4d29000 r-xs 00000000 08:02 3560014 /var/cache/fontconfig/945677eb7aeaf62f1d50efc3fb3ec7d8-x86.cache-2 +b4d29000-b4d2c000 r-xs 00000000 08:02 3560019 /var/cache/fontconfig/e383d7ea5fbe662a33d9b44caf393297-x86.cache-2 +b4d2c000-b4d31000 r-xs 00000000 08:02 3560011 /var/cache/fontconfig/bddabcf04192498a6a74911686fc6962-x86.cache-2 +b4d31000-b4d34000 r-xs 00000000 08:02 3556212 /var/cache/fontconfig/a46337af8a0b4c9b317ad981ec3bdf87-x86.cache-2 +b4d34000-b4d35000 r-xs 00000000 08:02 3560013 /var/cache/fontconfig/fd9505950c048a77dc4b710eb6a628ed-x86.cache-2 +b4d35000-b4d37000 r-xs 00000000 08:02 3560021 /var/cache/fontconfig/ddc79d3ea06a7c6ffa86ede85f3bb5df-x86.cache-2 +b4d37000-b4d38000 r-xs 00000000 08:02 3560164 /var/cache/fontconfig/e3fa16a14183b06aa45b3e009278fd14-x86.cache-2 +b4d38000-b4d39000 r-xs 00000000 08:02 3560125 /var/cache/fontconfig/e7071f4a29fa870f4323321c154eba04-x86.cache-2 +b4d39000-b4d3a000 r-xs 00000000 08:02 3560023 /var/cache/fontconfig/a2ab74764b07279e7c36ddb1d302cf26-x86.cache-2 +b4d3a000-b4d3e000 r-xs 00000000 08:02 3560003 /var/cache/fontconfig/921a30a17f0be15c70ac14043cb7a739-x86.cache-2 +b4d3e000-b4d3f000 r-xs 00000000 08:02 3560018 /var/cache/fontconfig/c69f04ab05004e31a6d5e715764f16d8-x86.cache-2 +b4d3f000-b4d40000 r-xs 00000000 08:02 3560008 /var/cache/fontconfig/4c73fe0c47614734b17d736dbde7580a-x86.cache-2 +b4d40000-b4d42000 r-xs 00000000 08:02 3560007 /var/cache/fontconfig/646addb8444faa74ee138aa00ab0b6a0-x86.cache-2 +b4d42000-b4d45000 r-xs 00000000 08:02 3560006 /var/cache/fontconfig/a755afe4a08bf5b97852ceb7400b47bc-x86.cache-2 +b4d45000-b4d47000 r-xs 00000000 08:02 3560015 /var/cache/fontconfig/20bd79ad97094406f7d1b9654bfbd926-x86.cache-2 +b4d47000-b4d49000 r-xs 00000000 08:02 3560009 /var/cache/fontconfig/9c0624108b9a2ae8552f664125be8356-x86.cache-2 +b4d49000-b4d50000 r-xs 00000000 08:02 3560004 /var/cache/fontconfig/6d41288fd70b0be22e8c3a91e032eec0-x86.cache-2 +b4d50000-b4d53000 r-xs 00000000 08:02 3560012 /var/cache/fontconfig/de156ccd2eddbdc19d37a45b8b2aac9c-x86.cache-2 +b4d53000-b4d55000 r-xs 00000000 08:02 3556204 /var/cache/fontconfig/da1bd5ca8443ffe22927a23ce431d198-x86.cache-2 +b4d55000-b4d5d000 r-xs 00000000 08:02 3560169 /var/cache/fontconfig/e3de0de479f42330eadf588a55fb5bf4-x86.cache-2 +b4d5d000-b4d65000 r-xs 00000000 08:02 2409868 /var/cache/fontconfig/0f34bcd4b6ee430af32735b75db7f02b-x86.cache-2 +b4d65000-b4d66000 r-xs 00000000 08:02 3560126 /var/cache/fontconfig/4794a0821666d79190d59a36cb4f44b5-x86.cache-2 +b4d66000-b4d88000 r-xs 00000000 08:02 1392718 /var/cache/fontconfig/365b55f210c0a22e9a19e35191240f32-x86.cache-2 +b4d88000-b4d8a000 r-xs 00000000 08:02 3560017 /var/cache/fontconfig/2c5ba8142dffc8bf0377700342b8ca1a-x86.cache-2 +b4d8a000-b4d8d000 r-xs 00000000 08:02 3560022 /var/cache/fontconfig/de9486f0b47a4d768a594cb4198cb1c6-x86.cache-2 +b4d8d000-b4d94000 r-xs 00000000 08:02 3556202 /var/cache/fontconfig/d52a8644073d54c13679302ca1180695-x86.cache-2 +b4d94000-b4d99000 r-xs 00000000 08:02 3558093 /var/cache/fontconfig/105b9c7e6f0a4f82d8c9b6e39c52c6f9-x86.cache-2 +b4d99000-b4d9c000 r-xs 00000000 08:02 3560677 /var/cache/fontconfig/6386b86020ecc1ef9690bb720a13964f-x86.cache-2 +b4d9c000-b4da7000 r-xs 00000000 08:02 3556115 /var/cache/fontconfig/089dead882dea3570ffc31a9898cfb69-x86.cache-2 +b4da7000-b4db4000 r-xs 00000000 08:02 2409873 /var/cache/fontconfig/e13b20fdb08344e0e664864cc2ede53d-x86.cache-2 +b4dd5000-b4dd8000 ---p b4dd5000 00:00 0 +b4dd8000-b4e26000 rwxp b4dd8000 00:00 0 +b4e3b000-b4e46000 rwxs 00000000 00:09 1831534605 /SYSV00000000 (deleted) +b4e46000-b4e47000 r--s 0000f000 00:11 751021 /var/run/pcscd/pcscd.pub +b4e47000-b4e48000 r--s 0000e000 00:11 751021 /var/run/pcscd/pcscd.pub +b4e48000-b4e49000 r--s 0000d000 00:11 751021 /var/run/pcscd/pcscd.pub +b4e49000-b4e4a000 r--s 0000c000 00:11 751021 /var/run/pcscd/pcscd.pub +b4e4a000-b4e4b000 r--s 0000b000 00:11 751021 /var/run/pcscd/pcscd.pub +b4e4b000-b4e4c000 r--s 0000a000 00:11 751021 /var/run/pcscd/pcscd.pub +b4e4c000-b4e4d000 r--s 00009000 00:11 751021 /var/run/pcscd/pcscd.pub +b4e4d000-b4e4e000 r--s 00008000 00:11 751021 /var/run/pcscd/pcscd.pub +b4e4e000-b4e4f000 r--s 00007000 00:11 751021 /var/run/pcscd/pcscd.pub +b4e4f000-b4e50000 r--s 00006000 00:11 751021 /var/run/pcscd/pcscd.pub +b4e50000-b4e51000 r--s 00005000 00:11 751021 /var/run/pcscd/pcscd.pub +b4e51000-b4e52000 r--s 00004000 00:11 751021 /var/run/pcscd/pcscd.pub +b4e52000-b4e5a000 r-xp 00000000 08:02 901283 /usr/lib/libpcsclite.so.1.0.0 +b4e5a000-b4e5b000 rwxp 00008000 08:02 901283 /usr/lib/libpcsclite.so.1.0.0 +b4e5b000-b4e5d000 r-xp 00000000 08:02 1085449 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libj2pcsc.so +b4e5d000-b4e5e000 rwxp 00001000 08:02 1085449 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libj2pcsc.so +b4e5e000-b4e61000 rwxp b4e5e000 00:00 0 +b4e61000-b4eaf000 rwxp b4e61000 00:00 0 +b4eaf000-b4eb2000 ---p b4eaf000 00:00 0 +b4eb2000-b4fd2000 rwxp b4eb2000 00:00 0 +b4fd2000-b5000000 ---p b4fd2000 00:00 0 +b5000000-b5001000 r--s 00003000 00:11 751021 /var/run/pcscd/pcscd.pub +b5001000-b5004000 r-xs 00027000 08:02 1086682 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/ext/sunjce_provider.jar +b5004000-b5036000 rwxp b5004000 00:00 0 +b5036000-b503a000 r-xs 00000000 08:02 3555788 /var/cache/fontconfig/4a195c91033ef4528a35b4a1ac51414e-x86.cache-2 +b503a000-b5048000 r-xs 00000000 08:02 3557818 /var/cache/fontconfig/865f88548240fee46819705c6468c165-x86.cache-2 +b5048000-b504f000 r-xs 00110000 08:02 1065527 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/resources.jar +b504f000-b5077000 rwxp b504f000 00:00 0 +b5077000-b507e000 r-xp 00000000 08:02 1085443 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libnio.so +b507e000-b507f000 rwxp 00006000 08:02 1085443 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libnio.so +b507f000-b5082000 ---p b507f000 00:00 0 +b5082000-b50d0000 rwxp b5082000 00:00 0 +b50d0000-b50d3000 ---p b50d0000 00:00 0 +b50d3000-b5121000 rwxp b50d3000 00:00 0 +b5121000-b5124000 r-xs 00000000 08:02 3560016 /var/cache/fontconfig/5e10083637a12ecd1bff191eb66bfa2f-x86.cache-2 +b5124000-b512a000 r-xs 00000000 08:02 3560014 /var/cache/fontconfig/945677eb7aeaf62f1d50efc3fb3ec7d8-x86.cache-2 +b512a000-b512d000 r-xs 00000000 08:02 3560019 /var/cache/fontconfig/e383d7ea5fbe662a33d9b44caf393297-x86.cache-2 +b512d000-b5132000 r-xs 00000000 08:02 3560011 /var/cache/fontconfig/bddabcf04192498a6a74911686fc6962-x86.cache-2 +b5132000-b5135000 r-xs 00000000 08:02 3556212 /var/cache/fontconfig/a46337af8a0b4c9b317ad981ec3bdf87-x86.cache-2 +b5135000-b5136000 r-xs 00000000 08:02 3560013 /var/cache/fontconfig/fd9505950c048a77dc4b710eb6a628ed-x86.cache-2 +b5136000-b5138000 r-xs 00000000 08:02 3560021 /var/cache/fontconfig/ddc79d3ea06a7c6ffa86ede85f3bb5df-x86.cache-2 +b5138000-b5139000 r-xs 00000000 08:02 3560164 /var/cache/fontconfig/e3fa16a14183b06aa45b3e009278fd14-x86.cache-2 +b5139000-b513a000 r-xs 00000000 08:02 3560125 /var/cache/fontconfig/e7071f4a29fa870f4323321c154eba04-x86.cache-2 +b513a000-b513b000 r-xs 00000000 08:02 3560023 /var/cache/fontconfig/a2ab74764b07279e7c36ddb1d302cf26-x86.cache-2 +b513b000-b513f000 r-xs 00000000 08:02 3560003 /var/cache/fontconfig/921a30a17f0be15c70ac14043cb7a739-x86.cache-2 +b513f000-b5140000 r-xs 00000000 08:02 3560018 /var/cache/fontconfig/c69f04ab05004e31a6d5e715764f16d8-x86.cache-2 +b5140000-b5141000 r-xs 00000000 08:02 3560008 /var/cache/fontconfig/4c73fe0c47614734b17d736dbde7580a-x86.cache-2 +b5141000-b5143000 r-xs 00000000 08:02 3560007 /var/cache/fontconfig/646addb8444faa74ee138aa00ab0b6a0-x86.cache-2 +b5143000-b5146000 r-xs 00000000 08:02 3560006 /var/cache/fontconfig/a755afe4a08bf5b97852ceb7400b47bc-x86.cache-2 +b5146000-b5148000 r-xs 00000000 08:02 3560015 /var/cache/fontconfig/20bd79ad97094406f7d1b9654bfbd926-x86.cache-2 +b5148000-b514a000 r-xs 00000000 08:02 3560009 /var/cache/fontconfig/9c0624108b9a2ae8552f664125be8356-x86.cache-2 +b514a000-b5151000 r-xs 00000000 08:02 3560004 /var/cache/fontconfig/6d41288fd70b0be22e8c3a91e032eec0-x86.cache-2 +b5151000-b5154000 r-xs 00000000 08:02 3560012 /var/cache/fontconfig/de156ccd2eddbdc19d37a45b8b2aac9c-x86.cache-2 +b5154000-b5156000 r-xs 00000000 08:02 3556204 /var/cache/fontconfig/da1bd5ca8443ffe22927a23ce431d198-x86.cache-2 +b5156000-b515e000 r-xs 00000000 08:02 3560169 /var/cache/fontconfig/e3de0de479f42330eadf588a55fb5bf4-x86.cache-2 +b515e000-b5166000 r-xs 00000000 08:02 2409868 /var/cache/fontconfig/0f34bcd4b6ee430af32735b75db7f02b-x86.cache-2 +b5166000-b5167000 r-xs 00000000 08:02 3560126 /var/cache/fontconfig/4794a0821666d79190d59a36cb4f44b5-x86.cache-2 +b5167000-b5189000 r-xs 00000000 08:02 1392718 /var/cache/fontconfig/365b55f210c0a22e9a19e35191240f32-x86.cache-2 +b5189000-b518b000 r-xs 00000000 08:02 3560017 /var/cache/fontconfig/2c5ba8142dffc8bf0377700342b8ca1a-x86.cache-2 +b518b000-b518e000 r-xs 00000000 08:02 3560022 /var/cache/fontconfig/de9486f0b47a4d768a594cb4198cb1c6-x86.cache-2 +b518e000-b5195000 r-xs 00000000 08:02 3556202 /var/cache/fontconfig/d52a8644073d54c13679302ca1180695-x86.cache-2 +b5195000-b519a000 r-xs 00000000 08:02 3558093 /var/cache/fontconfig/105b9c7e6f0a4f82d8c9b6e39c52c6f9-x86.cache-2 +b519a000-b519d000 r-xs 00000000 08:02 3560677 /var/cache/fontconfig/6386b86020ecc1ef9690bb720a13964f-x86.cache-2 +b519d000-b51a8000 r-xs 00000000 08:02 3556115 /var/cache/fontconfig/089dead882dea3570ffc31a9898cfb69-x86.cache-2 +b51a8000-b51b5000 r-xs 00000000 08:02 2409873 /var/cache/fontconfig/e13b20fdb08344e0e664864cc2ede53d-x86.cache-2 +b51b5000-b51bb000 r-xs 00091000 08:02 1065704 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/jsse.jar +b51bb000-b51be000 rwxp b51bb000 00:00 0 +b51be000-b520c000 rwxp b51be000 00:00 0 +b520c000-b520f000 ---p b520c000 00:00 0 +b520f000-b525d000 rwxp b520f000 00:00 0 +b525d000-b5264000 r-xp 00000000 08:02 1343649 /usr/lib/libXrender.so.1.3.0 +b5264000-b5265000 rwxp 00007000 08:02 1343649 /usr/lib/libXrender.so.1.3.0 +b5265000-b526d000 r-xp 00000000 08:02 1343710 /usr/lib/libXcursor.so.1.0.2 +b526d000-b526e000 rwxp 00007000 08:02 1343710 /usr/lib/libXcursor.so.1.0.2 +b526e000-b526f000 r--s 00002000 00:11 751021 /var/run/pcscd/pcscd.pub +b526f000-b5271000 r-xs 00017000 08:02 4065150 /home/clemens/workspace/mocca/BKUApplet/target/test-libs/iaik_jce_me4se-3.04.jar +b5271000-b5284000 r-xp 00000000 08:02 1085442 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libnet.so +b5284000-b5285000 rwxp 00013000 08:02 1085442 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libnet.so +b5285000-b5288000 ---p b5285000 00:00 0 +b5288000-b52d6000 rwxp b5288000 00:00 0 +b52d6000-b5354000 r-xp 00000000 08:02 1085586 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libfontmanager.so +b5354000-b535e000 rwxp 0007e000 08:02 1085586 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libfontmanager.so +b535e000-b5363000 rwxp b535e000 00:00 0 +b5363000-b536a000 r-xp 00000000 08:02 1343653 /usr/lib/libXi.so.6.0.0 +b536a000-b536b000 rwxp 00006000 08:02 1343653 /usr/lib/libXi.so.6.0.0 +b536b000-b5378000 r-xp 00000000 08:02 902010 /usr/lib/libXext.so.6.4.0 +b5378000-b5379000 rwxp 0000d000 08:02 902010 /usr/lib/libXext.so.6.4.0 +b5379000-b53ba000 r-xp 00000000 08:02 1085581 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/xawt/libmawt.so +b53ba000-b53bd000 rwxp 00040000 08:02 1085581 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/xawt/libmawt.so +b53bd000-b5438000 r-xp 00000000 08:02 1085578 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libawt.so +b5438000-b543f000 rwxp 0007b000 08:02 1085578 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libawt.so +b543f000-b5463000 rwxp b543f000 00:00 0 +b5463000-b54c2000 r-xs 00b89000 08:02 1085573 /usr/lib/jvm/java-6-sun-1.6.0.06/lib/tools.jar +b54c2000-b54f4000 rwxp b54c2000 00:00 0 +b54f4000-b567f000 r-xs 02df0000 08:02 1065570 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/rt.jar +b567f000-b5680000 ---p b567f000 00:00 0 +b5680000-b5800000 rwxp b5680000 00:00 0 +b5800000-b5801000 r--s 00001000 00:11 751021 /var/run/pcscd/pcscd.pub +b5801000-b5803000 r-xs 0000d000 08:02 4065123 /home/clemens/workspace/mocca/BKUApplet/target/test-libs/commons-logging-1.1.1.jar +b5803000-b5807000 r-xs 0002d000 08:02 4050367 /home/clemens/workspace/mocca/BKUApplet/target/BKUApplet-1.0-SNAPSHOT.jar +b5807000-b580b000 r-xp 00000000 08:02 1343688 /usr/lib/libXtst.so.6.1.0 +b580b000-b580c000 rwxp 00003000 08:02 1343688 /usr/lib/libXtst.so.6.1.0 +b580c000-b5810000 r-xp 00000000 08:02 905383 /usr/lib/libXfixes.so.3.1.0 +b5810000-b5811000 rwxp 00003000 08:02 905383 /usr/lib/libXfixes.so.3.1.0 +b5811000-b5815000 r-xs 00000000 08:02 3555788 /var/cache/fontconfig/4a195c91033ef4528a35b4a1ac51414e-x86.cache-2 +b5815000-b5823000 r-xs 00000000 08:02 3557818 /var/cache/fontconfig/865f88548240fee46819705c6468c165-x86.cache-2 +b5823000-b5826000 ---p b5823000 00:00 0 +b5826000-b5874000 rwxp b5826000 00:00 0 +b5874000-b5877000 ---p b5874000 00:00 0 +b5877000-b58f5000 rwxp b5877000 00:00 0 +b58f5000-b58f8000 ---p b58f5000 00:00 0 +b58f8000-b5946000 rwxp b58f8000 00:00 0 +b5946000-b594d000 r-xs 00000000 08:02 912666 /usr/lib/gconv/gconv-modules.cache +b594d000-b598c000 r-xp 00000000 08:02 2162962 /usr/lib/locale/de_AT.utf8/LC_CTYPE +b598c000-b598f000 ---p b598c000 00:00 0 +b598f000-b59dd000 rwxp b598f000 00:00 0 +b59dd000-b59e0000 ---p b59dd000 00:00 0 +b59e0000-b5a2e000 rwxp b59e0000 00:00 0 +b5a2e000-b5a2f000 ---p b5a2e000 00:00 0 +b5a2f000-b5abd000 rwxp b5a2f000 00:00 0 +b5abd000-b5ad7000 rwxp b5abd000 00:00 0 +b5ad7000-b5ada000 rwxp b5ad7000 00:00 0 +b5ada000-b5af5000 rwxp b5ada000 00:00 0 +b5af5000-b5af6000 rwxp b5af5000 00:00 0 +b5af6000-b5af7000 rwxp b5af6000 00:00 0 +b5af7000-b5afa000 rwxp b5af7000 00:00 0 +b5afa000-b5b15000 rwxp b5afa000 00:00 0 +b5b15000-b5b1b000 rwxp b5b15000 00:00 0 +b5b1b000-b5b35000 rwxp b5b1b000 00:00 0 +b5b35000-b5b46000 rwxp b5b35000 00:00 0 +b5b46000-b5bc0000 rwxp b5b46000 00:00 0 +b5bc0000-b5d10000 rwxp b5bc0000 00:00 0 +b5d10000-b7bc0000 rwxp b5d10000 00:00 0 +b7bc0000-b7bcf000 r-xp 00000000 08:02 1085437 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libzip.so +b7bcf000-b7bd1000 rwxp 0000e000 08:02 1085437 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libzip.so +b7bd1000-b7bf4000 r-xp 00000000 08:02 1085434 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libjava.so +b7bf4000-b7bf6000 rwxp 00023000 08:02 1085434 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libjava.so +b7bf6000-b7bff000 r-xp 00000000 08:02 2785878 /lib/tls/i686/cmov/libnss_files-2.7.so +b7bff000-b7c01000 rwxp 00008000 08:02 2785878 /lib/tls/i686/cmov/libnss_files-2.7.so +b7c01000-b7c09000 r-xp 00000000 08:02 2785986 /lib/tls/i686/cmov/libnss_nis-2.7.so +b7c09000-b7c0b000 rwxp 00007000 08:02 2785986 /lib/tls/i686/cmov/libnss_nis-2.7.so +b7c0b000-b7c1f000 r-xp 00000000 08:02 2785874 /lib/tls/i686/cmov/libnsl-2.7.so +b7c1f000-b7c21000 rwxp 00013000 08:02 2785874 /lib/tls/i686/cmov/libnsl-2.7.so +b7c21000-b7c23000 rwxp b7c21000 00:00 0 +b7c23000-b7c24000 r--s 00000000 00:11 751021 /var/run/pcscd/pcscd.pub +b7c24000-b7c25000 r-xs 00000000 08:02 3556750 /var/cache/fontconfig/4c599c202bc5c08e2d34565a40eac3b2-x86.cache-2 +b7c25000-b7c26000 r-xs 00000000 08:02 3556750 /var/cache/fontconfig/4c599c202bc5c08e2d34565a40eac3b2-x86.cache-2 +b7c26000-b7c31000 r-xp 00000000 08:02 1085433 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libverify.so +b7c31000-b7c32000 rwxp 0000b000 08:02 1085433 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libverify.so +b7c32000-b7c3a000 rwxs 00000000 08:02 1328188 /tmp/hsperfdata_clemens/32072 +b7c3a000-b7c41000 r-xp 00000000 08:02 2786023 /lib/tls/i686/cmov/librt-2.7.so +b7c41000-b7c43000 rwxp 00006000 08:02 2786023 /lib/tls/i686/cmov/librt-2.7.so +b7c43000-b7c46000 ---p b7c43000 00:00 0 +b7c46000-b7c94000 rwxp b7c46000 00:00 0 +b7c94000-b7cb7000 r-xp 00000000 08:02 2785871 /lib/tls/i686/cmov/libm-2.7.so +b7cb7000-b7cb9000 rwxp 00023000 08:02 2785871 /lib/tls/i686/cmov/libm-2.7.so +b7cb9000-b7cba000 rwxp b7cb9000 00:00 0 +b7cba000-b7cbe000 r-xp 00000000 08:02 905230 /usr/lib/libXdmcp.so.6.0.0 +b7cbe000-b7cbf000 rwxp 00003000 08:02 905230 /usr/lib/libXdmcp.so.6.0.0 +b7cbf000-b7cc1000 r-xp 00000000 08:02 901311 /usr/lib/libXau.so.6.0.0 +b7cc1000-b7cc2000 rwxp 00001000 08:02 901311 /usr/lib/libXau.so.6.0.0 +b7cc2000-b7cd9000 r-xp 00000000 08:02 901194 /usr/lib/libxcb.so.1.0.0 +b7cd9000-b7cda000 rwxp 00016000 08:02 901194 /usr/lib/libxcb.so.1.0.0 +b7cda000-b7cdb000 rwxp b7cda000 00:00 0 +b7cdb000-b7cdc000 r-xp 00000000 08:02 901196 /usr/lib/libxcb-xlib.so.0.0.0 +b7cdc000-b7cdd000 rwxp 00000000 08:02 901196 /usr/lib/libxcb-xlib.so.0.0.0 +b7cdd000-b7e26000 r-xp 00000000 08:02 2785863 /lib/tls/i686/cmov/libc-2.7.so +b7e26000-b7e27000 r-xp 00149000 08:02 2785863 /lib/tls/i686/cmov/libc-2.7.so +b7e27000-b7e29000 rwxp 0014a000 08:02 2785863 /lib/tls/i686/cmov/libc-2.7.so +b7e29000-b7e2c000 rwxp b7e29000 00:00 0 +b7e2c000-b7e2e000 r-xp 00000000 08:02 2785869 /lib/tls/i686/cmov/libdl-2.7.so +b7e2e000-b7e30000 rwxp 00001000 08:02 2785869 /lib/tls/i686/cmov/libdl-2.7.so +b7e30000-b7e37000 r-xp 00000000 08:02 1085436 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/jli/libjli.so +b7e37000-b7e39000 rwxp 00006000 08:02 1085436 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/jli/libjli.so +b7e39000-b7f1d000 r-xp 00000000 08:02 901308 /usr/lib/libX11.so.6.2.0 +b7f1d000-b7f20000 rwxp 000e4000 08:02 901308 /usr/lib/libX11.so.6.2.0 +b7f20000-b7f21000 rwxp b7f20000 00:00 0 +b7f21000-b7f35000 r-xp 00000000 08:02 2786020 /lib/tls/i686/cmov/libpthread-2.7.so +b7f35000-b7f37000 rwxp 00013000 08:02 2786020 /lib/tls/i686/cmov/libpthread-2.7.so +b7f37000-b7f3e000 rwxp b7f37000 00:00 0 +b7f3e000-b7f45000 r-xp 00000000 08:02 2785875 /lib/tls/i686/cmov/libnss_compat-2.7.so +b7f45000-b7f47000 rwxp 00006000 08:02 2785875 /lib/tls/i686/cmov/libnss_compat-2.7.so +b7f47000-b7f4d000 r-xp 00000000 08:02 1085422 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/native_threads/libhpi.so +b7f4d000-b7f4e000 rwxp 00006000 08:02 1085422 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/native_threads/libhpi.so +b7f4e000-b7f4f000 rwxp b7f4e000 00:00 0 +b7f4f000-b7f50000 r-xp b7f4f000 00:00 0 +b7f50000-b7f52000 rwxp b7f50000 00:00 0 +b7f52000-b7f53000 r-xp b7f52000 00:00 0 [vdso] +b7f53000-b7f6d000 r-xp 00000000 08:02 2786582 /lib/ld-2.7.so +b7f6d000-b7f6f000 rwxp 00019000 08:02 2786582 /lib/ld-2.7.so +bfaac000-bfac1000 rwxp bffeb000 00:00 0 [stack] + +VM Arguments: +jvm_args: -Dapplication.home=/usr/lib/jvm/java-6-sun-1.6.0.06 +java_command: sun.applet.Main target/test-classes/appletTest.html +Launcher Type: SUN_STANDARD + +Environment Variables: +JAVA_HOME=/usr/lib/jvm/java-6-sun +PATH=/home/clemens/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games +LD_LIBRARY_PATH=/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client:/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386:/usr/lib/jvm/java-6-sun-1.6.0.06/jre/../lib/i386 +SHELL=/bin/bash +DISPLAY=:0 + +Signal Handlers: +SIGSEGV: [libjvm.so+0x3be710], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 +SIGBUS: [libjvm.so+0x3be710], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 +SIGFPE: [libjvm.so+0x30f810], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 +SIGPIPE: [libjvm.so+0x30f810], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 +SIGXFSZ: [libjvm.so+0x30f810], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 +SIGILL: [libjvm.so+0x30f810], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 +SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000 +SIGUSR2: [libjvm.so+0x311850], sa_mask[0]=0x00000000, sa_flags=0x10000004 +SIGHUP: [libjvm.so+0x3115f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 +SIGINT: [libjvm.so+0x3115f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 +SIGTERM: [libjvm.so+0x3115f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 +SIGQUIT: [libjvm.so+0x3115f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004 + + +--------------- S Y S T E M --------------- + +OS:lenny/sid + +uname:Linux 2.6.24-19-generic #1 SMP Fri Jul 11 23:41:49 UTC 2008 i686 +libc:glibc 2.7 NPTL 2.7 +rlimit: STACK 8192k, CORE 0k, NPROC 16381, NOFILE 1024, AS infinity +load average:0.84 0.39 0.22 + +CPU:total 2 (1 cores per cpu, 2 threads per core) family 15 model 4 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ht + +Memory: 4k page, physical 2075432k(62584k free), swap 1542200k(1502244k free) + +vm_info: Java HotSpot(TM) Client VM (10.0-b22) for linux-x86 JRE (1.6.0_06-b02), built on Mar 25 2008 00:39:19 by "java_re" with gcc 3.2.1-7a (J2SE release) + +time: Thu Oct 9 12:01:31 2008 +elapsed time: 55 seconds + 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 34dd9bbd..6a781729 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 @@ -16,9 +16,12 @@ */ package at.gv.egiz.bku.online.applet; +import java.net.MalformedURLException; import java.util.Locale; import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.net.ssl.HttpsURLConnection; import javax.swing.JApplet; @@ -27,6 +30,7 @@ import org.apache.commons.logging.LogFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIFactory; +import java.net.URL; /** * Note: all swing code is executed by the event dispatch thread (see @@ -40,6 +44,8 @@ public class BKUApplet extends JApplet { public final static String LOGO_URL_KEY = "LogoURL"; public final static String WSDL_URL = "WSDL_URL"; public final static String SESSION_ID = "SessionID"; + public static final String BACKGROUND_PARAM = "background"; + protected ResourceBundle resourceBundle; protected BKUWorker worker; protected Thread workerThread; @@ -58,8 +64,17 @@ public class BKUApplet extends JApplet { } else { resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE); } + String backgroundString = getMyAppletParameter(BACKGROUND_PARAM); + URL background = null; + if (backgroundString != null) { + try { + background = new URL(backgroundString); + } catch (MalformedURLException ex) { + log.warn(ex.getMessage() + ", using default background"); + } + } BKUGUIFacade gui = BKUGUIFactory.createGUI(); - gui.init(getContentPane(), localeString); + gui.init(getContentPane(), localeString, background); worker = new BKUWorker(gui, this, resourceBundle); } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java index 636a9fef..53ec1088 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java @@ -36,6 +36,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.net.URL; import java.text.MessageFormat; import java.util.List; import java.util.Locale; @@ -127,7 +128,7 @@ public class BKUGUI implements BKUGUIFacade { * @param localeString may be null */ @Override - public void init(final Container contentPane, String localeString) { + public void init(final Container contentPane, String localeString, final URL background) { if (localeString != null) { messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString)); @@ -149,7 +150,7 @@ public class BKUGUI implements BKUGUIFacade { log.debug("initializing gui"); // initIconPanel(); - initContentPanel(); + initContentPanel(background); GroupLayout layout = new GroupLayout(contentPane); contentPane.setLayout(layout); @@ -189,7 +190,7 @@ public class BKUGUI implements BKUGUIFacade { // .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //); // } - protected void initContentPanel() { + protected void initContentPanel(URL background) { contentPanel = new JPanel(); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index 32eb4c3e..4925e7fa 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -20,6 +20,7 @@ import at.gv.egiz.stal.HashDataInput; import at.gv.egiz.smcc.PINSpec; import java.awt.Container; import java.awt.event.ActionListener; +import java.net.URL; import java.util.List; public interface BKUGUIFacade { @@ -32,7 +33,7 @@ public interface BKUGUIFacade { public static final String ERR_WRITE_HASHDATA = "error.write.hashdata"; public static final String ERR_INVALID_HASH = "error.invalid.hash"; - public void init(Container contentPane, String localeString); + public void init(Container contentPane, String localeString, URL background); public void showWelcomeDialog(); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java new file mode 100644 index 00000000..e9c270ce --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java @@ -0,0 +1,37 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.bku.gui; + +import java.awt.Graphics; +import java.awt.Image; +import java.net.URL; +import javax.swing.ImageIcon; +import javax.swing.JPanel; + +/** + * + * @author clemens + */ +public class ImagePanel extends JPanel { + + protected Image backgroundImg; + + public ImagePanel(URL background) { + this(new ImageIcon(background).getImage()); + } + + public ImagePanel(Image img) { + this.backgroundImg = img; + this.setOpaque(false); + } + + @Override + public void paintComponent(Graphics g) { + super.paintComponent(g); + g.drawImage(backgroundImg, 0, this.getHeight() - backgroundImg.getHeight(null), null); + } + +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java index b7d86d05..8e32d67e 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java @@ -36,6 +36,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.net.URL; import java.text.MessageFormat; import java.util.List; import java.util.Locale; @@ -53,6 +54,7 @@ import javax.swing.JTable; import javax.swing.JTextArea; import javax.swing.LayoutStyle; import javax.swing.SwingUtilities; +import javax.swing.border.TitledBorder; import javax.swing.table.TableColumn; import javax.swing.table.TableModel; import org.apache.commons.logging.Log; @@ -66,7 +68,7 @@ public class SimpleGUI implements BKUGUIFacade { private static final Log log = LogFactory.getLog(SimpleGUI.class); public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages"; - public static final String LOGO_RESOURCE = "/images/logo.png"; + public static final String DEFAULT_BACKGROUND = "/images/mocca_default.png"; //logo.png"; public static final String HASHDATA_FONT = "Monospaced"; public static final Color ERROR_COLOR = Color.RED; public static final Color HYPERLINK_COLOR = Color.BLUE; @@ -121,13 +123,13 @@ public class SimpleGUI implements BKUGUIFacade { protected int buttonSize; private static final int CHECKBOX_WIDTH = new JCheckBox().getPreferredSize().width; - + /** * @param contentPane * @param localeString may be null */ @Override - public void init(final Container contentPane, String localeString) { + public void init(final Container contentPane, String localeString, final URL background) { if (localeString != null) { messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString)); @@ -149,7 +151,7 @@ public class SimpleGUI implements BKUGUIFacade { log.debug("initializing gui"); // initIconPanel(); - initContentPanel(); + initContentPanel(background); GroupLayout layout = new GroupLayout(contentPane); contentPane.setLayout(layout); @@ -189,13 +191,20 @@ public class SimpleGUI implements BKUGUIFacade { // .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //); // } - protected void initContentPanel() { + protected void initContentPanel(URL background) { - contentPanel = new JPanel(); + if (background == null) { + background = this.getClass().getResource(DEFAULT_BACKGROUND); + } + contentPanel = new ImagePanel(background); +// contentPanel.setBorder(new TitledBorder("content")); + // headerPanel = new JPanel(); mainPanel = new JPanel(); - buttonPanel = new JPanel(); + mainPanel.setOpaque(false); + buttonPanel = new JPanel(); // new ImagePanel(LOGO_RESOURCE); //new JPanel(); + buttonPanel.setOpaque(false); // headerPanel.setBorder(new TitledBorder("header")); // mainPanel.setBorder(new TitledBorder("main")); @@ -487,13 +496,14 @@ public class SimpleGUI implements BKUGUIFacade { // cancelButton.addActionListener(cancelListener); JButton okButton = new JButton(); + okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD)); okButton.setText(messages.getString(BUTTON_OK)); okButton.setEnabled(false); okButton.setActionCommand(okCommand); okButton.addActionListener(okListener); JLabel cardPinLabel = new JLabel(); - cardPinLabel.setFont(cardPinLabel.getFont().deriveFont(cardPinLabel.getFont().getStyle() | java.awt.Font.BOLD)); + cardPinLabel.setFont(cardPinLabel.getFont().deriveFont(cardPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); String pinLabel = messages.getString(LABEL_PIN); cardPinLabel.setText(MessageFormat.format(pinLabel, new Object[]{pinSpec.getLocalizedName()})); @@ -513,8 +523,8 @@ public class SimpleGUI implements BKUGUIFacade { }); JLabel infoLabel = new JLabel(); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD, infoLabel.getFont().getSize()-2)); if (numRetries < 0) { - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); String pinsizePattern = messages.getString(LABEL_PINSIZE); String pinSize = String.valueOf(pinSpec.getMinLength()); if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { @@ -658,13 +668,14 @@ public class SimpleGUI implements BKUGUIFacade { // cancelButton.addActionListener(cancelListener); JButton signButton = new JButton(); + signButton.setFont(signButton.getFont().deriveFont(signButton.getFont().getStyle() & ~java.awt.Font.BOLD)); signButton.setText(messages.getString(BUTTON_SIGN)); signButton.setEnabled(false); signButton.setActionCommand(signCommand); signButton.addActionListener(signListener); JLabel signPinLabel = new JLabel(); - signPinLabel.setFont(signPinLabel.getFont().deriveFont(signPinLabel.getFont().getStyle() | java.awt.Font.BOLD)); + signPinLabel.setFont(signPinLabel.getFont().deriveFont(signPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); String pinLabel = messages.getString(LABEL_PIN); signPinLabel.setText(MessageFormat.format(pinLabel, new Object[]{pinSpec.getLocalizedName()})); @@ -684,7 +695,7 @@ public class SimpleGUI implements BKUGUIFacade { //pinsize or error label JLabel infoLabel = new JLabel(); - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD, infoLabel.getFont().getSize()-2)); if (numRetries < 0) { String pinsizePattern = messages.getString(LABEL_PINSIZE); String pinSize = String.valueOf(pinSpec.getMinLength()); @@ -721,7 +732,7 @@ public class SimpleGUI implements BKUGUIFacade { .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) // .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(infoLabel)); mainPanelLayout.setVerticalGroup( @@ -847,6 +858,7 @@ public class SimpleGUI implements BKUGUIFacade { .addComponent(errorMsgLabel)); JButton okButton = new JButton(); + okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD)); okButton.setText(messages.getString(BUTTON_OK)); okButton.setActionCommand(okCommand); okButton.addActionListener(okListener); @@ -1062,6 +1074,7 @@ public class SimpleGUI implements BKUGUIFacade { // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addComponent(refIdLabel).addGap(refIdLabel.getFont().getSize()).addComponent(hashDataScrollPane).addGap(refIdLabel.getFont().getSize()))); JButton backButton = new JButton(); + backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD)); backButton.setText(messages.getString(BUTTON_BACK)); backButton.setActionCommand(cancelCommand); backButton.addActionListener(cancelListener); @@ -1215,6 +1228,7 @@ public class SimpleGUI implements BKUGUIFacade { JButton backButton = new JButton(); + backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD)); backButton.setText(messages.getString(BUTTON_BACK)); backButton.setActionCommand(cancelCommand); backButton.addActionListener(cancelListener); diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index a2b5e0df..abed420f 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -34,7 +34,7 @@ message.hashdatalist={0} Signaturdatenobjekte: message.retries=Noch {0} Versuch(e) message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben? label.pin={0}: -label.pinsize=({0} stellig) +label.pinsize={0} stellig button.ok=OK button.cancel=Abbrechen button.back=Zur\u00FCck diff --git a/BKUCommonGUI/src/main/resources/images/mocca.png b/BKUCommonGUI/src/main/resources/images/mocca.png new file mode 100644 index 00000000..881a65c1 Binary files /dev/null and b/BKUCommonGUI/src/main/resources/images/mocca.png differ diff --git a/BKUCommonGUI/src/main/resources/images/mocca_default.png b/BKUCommonGUI/src/main/resources/images/mocca_default.png new file mode 100644 index 00000000..349d9ff0 Binary files /dev/null and b/BKUCommonGUI/src/main/resources/images/mocca_default.png differ diff --git a/BKUCommonGUI/src/main/resources/images/mocca_tiny.png b/BKUCommonGUI/src/main/resources/images/mocca_tiny.png new file mode 100644 index 00000000..1f125d9b Binary files /dev/null and b/BKUCommonGUI/src/main/resources/images/mocca_tiny.png differ 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 5f1bc8b2..308be642 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 @@ -40,7 +40,7 @@ public class BKUGUITest { BKUGUI gui = new BKUGUI(); Container contentPane = testFrame.getContentPane(); contentPane.setPreferredSize(new Dimension(380, 150)); - gui.init(contentPane, null); + gui.init(contentPane, null, null); BKUGUIWorker worker = new BKUGUIWorker(); worker.init(gui); testFrame.pack(); diff --git a/BKUOnline/src/main/webapp/META-INF/context.xml b/BKUOnline/src/main/webapp/META-INF/context.xml index 3568c9ec..cd11ce8e 100644 --- a/BKUOnline/src/main/webapp/META-INF/context.xml +++ b/BKUOnline/src/main/webapp/META-INF/context.xml @@ -16,3 +16,4 @@ limitations under the License. --> + diff --git a/BKUOnline/src/main/webapp/appletPage.jsp b/BKUOnline/src/main/webapp/appletPage.jsp index 59dc2ad5..11f46dca 100644 --- a/BKUOnline/src/main/webapp/appletPage.jsp +++ b/BKUOnline/src/main/webapp/appletPage.jsp @@ -42,7 +42,7 @@ height :<%= height %> }; var parameters = { - background : <%= backgroundImg %>, + background : '<%= backgroundImg %>', WSDL_URL :'../stal?wsdl', SessionID : '<%= session.getId() %>', redirectURL : '../bkuResult' diff --git a/BKUOnline/src/main/webapp/index.html b/BKUOnline/src/main/webapp/index.html index bf8b3ae0..8f1a338e 100644 --- a/BKUOnline/src/main/webapp/index.html +++ b/BKUOnline/src/main/webapp/index.html @@ -49,8 +49,6 @@

TestRequest

Security Layer Request -

FinanzOnline

-FinanzOnline Demo Integration

STAL Service

STAL Service Endpoint Information

-- cgit v1.2.3 From 8852be703a5cacaf271575ccee04bbe27612d16b Mon Sep 17 00:00:00 2001 From: wbauer Date: Fri, 10 Oct 2008 12:35:07 +0000 Subject: Improved Quit Handling for multiple applet instances git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@101 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 4 + .../at/gv/egiz/bku/online/applet/BKUWorker.java | 125 ++++++++++++--------- .../bku/online/applet/MultiInstanceHandler.java | 49 ++++++++ .../at/gv/egiz/bku/online/applet/QuitHandler.java | 37 ++++++ .../at/gv/egiz/smcc/AbstractSignatureCard.java | 6 +- smcc/src/main/java/at/gv/egiz/smcc/SWCard.java | 4 +- .../main/java/at/gv/egiz/smcc/SignatureCard.java | 2 +- .../at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java | 4 +- 8 files changed, 167 insertions(+), 64 deletions(-) create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/MultiInstanceHandler.java create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/QuitHandler.java (limited to 'BKUApplet') 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 6a781729..ab38c163 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 @@ -30,6 +30,9 @@ import org.apache.commons.logging.LogFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIFactory; +import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; +import at.gv.egiz.stal.QuitRequest; + import java.net.URL; /** @@ -56,6 +59,7 @@ public class BKUApplet extends JApplet { public void init() { log.info("Welcome to MOCCA\n"); log.debug("Called init()"); + AbstractSMCCSTAL.addRequestHandler(QuitRequest.class, QuitHandler.getInstance()); HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance()); String localeString = getMyAppletParameter(LOCALE_PARAM_KEY); if (localeString != null) { 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 12eb9d00..fbf74162 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,7 @@ import at.gv.egiz.stal.service.types.ResponseType; import at.gv.egiz.stal.util.STALTranslator; public class BKUWorker extends AbstractSMCCSTAL implements Runnable, - ActionListener, SMCCSTALRequestHandler { + ActionListener, SMCCSTALRequestHandler { private static Log log = LogFactory.getLog(BKUWorker.class); protected BKUGUIFacade gui; @@ -65,15 +65,15 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, * must not be null */ public BKUWorker(BKUGUIFacade gui, BKUApplet parent, - ResourceBundle errorMessageBundle) { + ResourceBundle errorMessageBundle) { if ((gui == null) || (parent == null) || (errorMessageBundle == null)) { throw new NullPointerException("Parameter must not be set to null"); } this.gui = gui; this.parent = parent; this.errorMessages = errorMessageBundle; - addRequestHandler(QuitRequest.class, this); - // register SignRequestHandler once we have a webservice port + QuitHandler.getInstance().registerHandlerInstance(this); + // register SignRequestHandler once we have a webservice port } /** @@ -85,7 +85,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, protected BKUWorker(BKUGUIFacade gui, ResourceBundle errorMessageBundle) { this.gui = gui; this.errorMessages = errorMessageBundle; - addRequestHandler(QuitRequest.class, this); + QuitHandler.getInstance().registerHandlerInstance(this); } private STALPortType getSTALPort() throws MalformedURLException { @@ -111,7 +111,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, } log.debug("Found WSDL url: " + wsdlURL); QName endpointName = new QName("http://www.egiz.gv.at/wsdl/stal", - "STALService"); + "STALService"); STALService stal = new STALService(wsdlURL, endpointName); return stal.getSTALPort(); } @@ -126,7 +126,8 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, log.fatal("Failed to call STAL service.", e); actionCommandList.clear(); actionCommandList.add("ok"); - gui.showErrorDialog(BKUGUIFacade.ERR_SERVICE_UNREACHABLE, new Object[] {e.getMessage()}); + gui.showErrorDialog(BKUGUIFacade.ERR_SERVICE_UNREACHABLE, + new Object[] { e.getMessage() }); try { waitForAction(); } catch (InterruptedException e1) { @@ -140,13 +141,16 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, // use the testsession for testing sessionId = "TestSession"; } - addRequestHandler(at.gv.egiz.stal.SignRequest.class, new WSSignRequestHandler(sessionId, stalPort)); + addRequestHandler(at.gv.egiz.stal.SignRequest.class, + new WSSignRequestHandler(sessionId, stalPort)); ObjectFactory of = new ObjectFactory(); GetNextRequestResponseType nextRequestResp = stalPort.connect(sessionId); do { - List requests = nextRequestResp.getInfoboxReadRequestOrSignRequestOrQuitRequest(); - List stalRequests = STALTranslator.translateRequests(requests); + List requests = nextRequestResp + .getInfoboxReadRequestOrSignRequestOrQuitRequest(); + List stalRequests = STALTranslator + .translateRequests(requests); if (log.isInfoEnabled()) { StringBuilder sb = new StringBuilder("Received "); @@ -190,27 +194,33 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, responses = new ArrayList(1); ErrorResponseType err = new ErrorResponseType(); err.setErrorCode(6002); -// err.setErrorMessage(); + // err.setErrorMessage(); responses.add(err); } if (!finished) { + log.info("Not finished yet (BKUWorker: " + this + + "), sending responses"); GetNextRequestType nextRequest = of.createGetNextRequestType(); nextRequest.setSessionId(sessionId); - nextRequest.getInfoboxReadResponseOrSignResponseOrErrorResponse().addAll(responses); + nextRequest.getInfoboxReadResponseOrSignResponseOrErrorResponse() + .addAll(responses); nextRequestResp = stalPort.getNextRequest(nextRequest); } } while (!finished); log.info("Done " + Thread.currentThread().getName()); } catch (Exception ex) { log.error(ex.getMessage(), ex); - gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {ex.getMessage()}); + gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] { ex + .getMessage() }); try { waitForAction(); } catch (InterruptedException e) { log.error(e); } } + signatureCard.disconnect(false); + QuitHandler.getInstance().unregisterHandlerInstance(this); sendRedirect(); } @@ -222,17 +232,20 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, URL url = null; if (redirectURL != null) { try { - url = new URL(parent.getCodeBase(), redirectURL + ";jsessionid=" + parent.getMyAppletParameter(BKUApplet.SESSION_ID)); + url = new URL(parent.getCodeBase(), redirectURL + ";jsessionid=" + + parent.getMyAppletParameter(BKUApplet.SESSION_ID)); } catch (MalformedURLException ex) { - log.warn("Parameter 'redirectURL': " + redirectURL + " not a valid URL.", ex); - // gui.showErrorDialog(errorMsg, okListener, actionCommand) + log.warn("Parameter 'redirectURL': " + redirectURL + + " not a valid URL.", ex); + // gui.showErrorDialog(errorMsg, okListener, actionCommand) } if (url != null) { if (redirectTarget == null) { log.info("Done. Trying to redirect to " + url + " ..."); parent.getAppletContext().showDocument(url); } else { - log.info("Done. Trying to redirect to " + url + " (target=" + redirectTarget + ") ..."); + log.info("Done. Trying to redirect to " + url + " (target=" + + redirectTarget + ") ..."); parent.getAppletContext().showDocument(url, redirectTarget); } } @@ -276,46 +289,46 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, int oldValue = SMCCHelper.PC_SC_NOT_SUPPORTED; // this is a save default while ((signatureCard == null) && (!actionPerformed)) { switch (smccHelper.getResultCode()) { - case SMCCHelper.PC_SC_NOT_SUPPORTED: + case SMCCHelper.PC_SC_NOT_SUPPORTED: + actionCommandList.clear(); + actionCommandList.add("ok"); + gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, this, "ok"); + try { + waitForAction(); + } catch (InterruptedException e) { + log.error(e); + } + return true; + case SMCCHelper.TERMINAL_NOT_PRESENT: + actionCommandList.clear(); + actionCommandList.add("ok"); + gui.showErrorDialog(BKUGUIFacade.ERR_NO_CARDTERMINAL, null, this, "ok"); + try { + waitForAction(); + } catch (InterruptedException e) { + log.error(e); + } + return true; + case SMCCHelper.CARD_NOT_SUPPORTED: + if (oldValue != SMCCHelper.CARD_NOT_SUPPORTED) { actionCommandList.clear(); - actionCommandList.add("ok"); - gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, this, "ok"); - try { - waitForAction(); - } catch (InterruptedException e) { - log.error(e); - } - return true; - case SMCCHelper.TERMINAL_NOT_PRESENT: + actionCommandList.add("cancel"); + gui.showCardNotSupportedDialog(this, "cancel"); + oldValue = SMCCHelper.CARD_NOT_SUPPORTED; + } + break; + case SMCCHelper.NO_CARD: + if (oldValue != SMCCHelper.NO_CARD) { actionCommandList.clear(); - actionCommandList.add("ok"); - gui.showErrorDialog(BKUGUIFacade.ERR_NO_CARDTERMINAL,null,this,"ok"); - try { - waitForAction(); - } catch (InterruptedException e) { - log.error(e); - } - return true; - case SMCCHelper.CARD_NOT_SUPPORTED: - if (oldValue != SMCCHelper.CARD_NOT_SUPPORTED) { - actionCommandList.clear(); - actionCommandList.add("cancel"); - gui.showCardNotSupportedDialog(this, "cancel"); - oldValue = SMCCHelper.CARD_NOT_SUPPORTED; - } - break; - case SMCCHelper.NO_CARD: - if (oldValue != SMCCHelper.NO_CARD) { - actionCommandList.clear(); - actionCommandList.add("cancel"); - gui.showInsertCardDialog(this, "cancel"); - oldValue = SMCCHelper.NO_CARD; - } - break; - case SMCCHelper.CARD_FOUND: - // gui.showWaitDialog(null); - signatureCard = smccHelper.getSignatureCard(errorMessages.getLocale()); - return false; + actionCommandList.add("cancel"); + gui.showInsertCardDialog(this, "cancel"); + oldValue = SMCCHelper.NO_CARD; + } + break; + case SMCCHelper.CARD_FOUND: + // gui.showWaitDialog(null); + signatureCard = smccHelper.getSignatureCard(errorMessages.getLocale()); + return false; } smccHelper.update(3000); } @@ -325,6 +338,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, @Override public STALResponse handleRequest(STALRequest request) { if (request instanceof QuitRequest) { + log.info("Setting state to: finished for BKUWorker " + this); finished = true; } else { log.error("Unexpected request to handle: " + request); @@ -350,4 +364,5 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, protected BKUGUIFacade getGUI() { return gui; } + } diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/MultiInstanceHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/MultiInstanceHandler.java new file mode 100644 index 00000000..a07df559 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/MultiInstanceHandler.java @@ -0,0 +1,49 @@ +package at.gv.egiz.bku.online.applet; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; +import at.gv.egiz.smcc.SignatureCard; +import at.gv.egiz.stal.QuitRequest; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; + +public abstract class MultiInstanceHandler implements SMCCSTALRequestHandler { + + private static Log log = LogFactory.getLog(MultiInstanceHandler.class); + + protected List handlerList = new ArrayList(); + + + + protected MultiInstanceHandler() { + } + + public void registerHandlerInstance(SMCCSTALRequestHandler handler) { + handlerList.add(handler); + } + + public void unregisterHandlerInstance(SMCCSTALRequestHandler handler) { + handlerList.remove(handler); + } + + + @Override + public void init(SignatureCard sc, BKUGUIFacade gui) { + } + + @Override + public SMCCSTALRequestHandler newInstance() { + return this; + } + + @Override + public boolean requireCard() { + return false; + } +} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/QuitHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/QuitHandler.java new file mode 100644 index 00000000..ab07e1a8 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/QuitHandler.java @@ -0,0 +1,37 @@ +package at.gv.egiz.bku.online.applet; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; +import at.gv.egiz.stal.QuitRequest; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; + +public class QuitHandler extends MultiInstanceHandler { + + private static Log log = LogFactory.getLog(QuitHandler.class); + + private static QuitHandler instance = new QuitHandler(); + + private QuitHandler() { + } + + public static QuitHandler getInstance() { + return instance; + } + + @Override + public STALResponse handleRequest(STALRequest request) { + if (request instanceof QuitRequest) { + log.info("Received QuitCommand"); + for (SMCCSTALRequestHandler handler : handlerList) { + handler.handleRequest(request); + } + } else { + log.error("Unexpected request to handle: " + request); + } + return null; + } + +} diff --git a/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java b/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java index ab6932d7..7f3a3b1c 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java @@ -262,11 +262,11 @@ public abstract class AbstractSignatureCard implements SignatureCard { } @Override - public void reset() { - log.debug("Resetting card"); + public void disconnect(boolean reset) { + log.debug("Disconnect called"); if (card_ != null) { try { - card_.disconnect(true); + card_.disconnect(reset); } catch (CardException e) { log.info("Error while resetting card", e); } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java b/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java index 28cce350..68a6f6df 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java @@ -320,9 +320,7 @@ public class SWCard implements SignatureCard { } @Override - public void reset() { - // TODO Auto-generated method stub - + public void disconnect(boolean reset) { } } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/SignatureCard.java b/smcc/src/main/java/at/gv/egiz/smcc/SignatureCard.java index 5e859d52..37bd7cf9 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/SignatureCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/SignatureCard.java @@ -79,7 +79,7 @@ public interface SignatureCard { public byte[] getCertificate(KeyboxName keyboxName) throws SignatureCardException; - public void reset(); + public void disconnect(boolean reset); /** * diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java index 9e47aeb8..b7697db1 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java @@ -91,7 +91,7 @@ public abstract class AbstractSMCCSTAL implements STAL { log.info("Got an error response"); if (++retryCounter < maxRetries) { log.info("Retrying"); - signatureCard.reset(); + signatureCard.disconnect(true); signatureCard = null; } else { responseList.add(response); @@ -109,7 +109,7 @@ public abstract class AbstractSMCCSTAL implements STAL { log.info("Error while handling STAL request:" + e); if (++retryCounter < maxRetries) { log.info("Retrying"); - signatureCard.reset(); + signatureCard.disconnect(true); signatureCard = null; } else { responseList.add(new ErrorResponse(6000)); -- cgit v1.2.3 From 255269ab17404fa1249c257e88815cbbee6e0d0f Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 13 Oct 2008 12:53:57 +0000 Subject: ExternalDisplaySignRequestHandler git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@105 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 1 + .../at/gv/egiz/bku/online/applet/BKUWorker.java | 32 +++- .../applet/ExternalDisplaySignRequestHandler.java | 45 +++++ .../online/applet/SignRequestHandlerFactory.java | 21 +++ .../bku/online/applet/WSSignRequestHandler.java | 168 ------------------- .../applet/WebServiceSignRequestHandler.java | 167 ++++++++++++++++++ .../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 1 + .../at/gv/egiz/bku/gui/Messages.properties | 1 + .../src/main/resources/images/chipperling_only.png | Bin 0 -> 3291 bytes .../main/resources/images/mocca_chipperling.png | Bin 0 -> 4103 bytes .../bku/local/stal/LocalSignRequestHandler.java | 93 +++++++---- BKUOnline/src/main/webapp/appletPage.jsp | 1 + .../bku/smccstal/CashedHashDataInputResolver.java | 27 --- .../gv/egiz/bku/smccstal/HashDataInputDisplay.java | 30 ++++ .../gv/egiz/bku/smccstal/SignRequestHandler.java | 186 ++++++--------------- 15 files changed, 407 insertions(+), 366 deletions(-) create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/SignRequestHandlerFactory.java delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java create mode 100644 BKUCommonGUI/src/main/resources/images/chipperling_only.png create mode 100644 BKUCommonGUI/src/main/resources/images/mocca_chipperling.png delete mode 100644 smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/CashedHashDataInputResolver.java create mode 100644 smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/HashDataInputDisplay.java (limited to 'BKUApplet') 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 ab38c163..32c4feaa 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 @@ -46,6 +46,7 @@ public class BKUApplet extends JApplet { public final static String LOCALE_PARAM_KEY = "Locale"; public final static String LOGO_URL_KEY = "LogoURL"; public final static String WSDL_URL = "WSDL_URL"; + public final static String HASHDATA_URL = "HashDataURL"; public final static String SESSION_ID = "SessionID"; public static final String BACKGROUND_PARAM = "background"; 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 fbf74162..d5ba4e40 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 @@ -46,6 +46,7 @@ import at.gv.egiz.stal.service.types.ErrorResponseType; import at.gv.egiz.stal.service.types.RequestType; import at.gv.egiz.stal.service.types.ResponseType; import at.gv.egiz.stal.util.STALTranslator; +import java.applet.AppletContext; public class BKUWorker extends AbstractSMCCSTAL implements Runnable, ActionListener, SMCCSTALRequestHandler { @@ -54,6 +55,7 @@ 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; @@ -115,13 +117,30 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, STALService stal = new STALService(wsdlURL, endpointName); return stal.getSTALPort(); } + + private URL getHashDataURL() throws MalformedURLException { + String hashDataParam = parent.getMyAppletParameter(BKUApplet.HASHDATA_URL); + URL codebase = parent.getCodeBase(); + if (hashDataParam != null) { + try { + return new URL(codebase, hashDataParam); +// log.debug("Found HashDataInputServlet URL: " + hashDataURL); + } catch (MalformedURLException ex) { + log.fatal("Paremeter " + BKUApplet.HASHDATA_URL + " is not a vailid URL.", ex); + throw new MalformedURLException(ex.getMessage()); + } + } else { + log.fatal("Paremeter " + BKUApplet.HASHDATA_URL + " not set"); + throw new MalformedURLException(BKUApplet.HASHDATA_URL + " not set"); + } + } @Override public void run() { gui.showWelcomeDialog(); try { stalPort = getSTALPort(); - + hashDataURL = getHashDataURL(); } catch (Exception e) { log.fatal("Failed to call STAL service.", e); actionCommandList.clear(); @@ -135,14 +154,21 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, } return; } + + //TODO factory for SignRequestHandler providing either WebServiceHDISignRequestHandler or ExternalHDIDisplaySignRequestHandler + AppletContext ctx = parent.getAppletContext(); + log.debug("register SignRequestHandler for HashDataURL " + hashDataURL); + addRequestHandler(at.gv.egiz.stal.SignRequest.class, new ExternalDisplaySignRequestHandler(ctx, hashDataURL)); + try { String sessionId = parent.getMyAppletParameter(BKUApplet.SESSION_ID); if (sessionId == null) { // use the testsession for testing sessionId = "TestSession"; } - addRequestHandler(at.gv.egiz.stal.SignRequest.class, - new WSSignRequestHandler(sessionId, stalPort)); + +// log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL); +// addRequestHandler(at.gv.egiz.stal.SignRequest.class, new WebServiceSignRequestHandler(sessionId, stalPort)); ObjectFactory of = new ObjectFactory(); GetNextRequestResponseType nextRequestResp = stalPort.connect(sessionId); diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java new file mode 100644 index 00000000..a9bbc559 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java @@ -0,0 +1,45 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.bku.online.applet; + +import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; +import at.gv.egiz.bku.smccstal.SignRequestHandler; +import at.gv.egiz.stal.signedinfo.ReferenceType; +import java.applet.AppletContext; +import java.net.URL; +import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author clemens + */ +public class ExternalDisplaySignRequestHandler extends SignRequestHandler { + + private static final Log log = LogFactory.getLog(ExternalDisplaySignRequestHandler.class); + + AppletContext ctx; + URL hashDataURL; + + public ExternalDisplaySignRequestHandler(AppletContext ctx, URL hashDataURL) { + this.ctx = ctx; + this.hashDataURL = hashDataURL; + } + + @Override + public SMCCSTALRequestHandler newInstance() { + return new ExternalDisplaySignRequestHandler(ctx, hashDataURL); + } + + @Override + public void displayHashDataInputs(List signedReferences) throws Exception { + //TODO pass reference Id's to servlet (TODO servlet) + log.debug("displaying hashdata inputs at " + hashDataURL); + ctx.showDocument(hashDataURL, "_blank"); + } + +} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/SignRequestHandlerFactory.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/SignRequestHandlerFactory.java new file mode 100644 index 00000000..327ea8aa --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/SignRequestHandlerFactory.java @@ -0,0 +1,21 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.bku.online.applet; + +import at.gv.egiz.bku.smccstal.SignRequestHandler; + +/** + * + * @author clemens + */ +public class SignRequestHandlerFactory { + + static SignRequestHandler getInstance() { + //TODO return ExternalDisplaySignRequestHandler by default, WebServiceSignRequestHandler if requested + //TODO get configuration as param + return null; + } +} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java deleted file mode 100644 index 3a36a290..00000000 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WSSignRequestHandler.java +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package at.gv.egiz.bku.online.applet; - -import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; -import at.gv.egiz.bku.smccstal.SignRequestHandler; -import at.gv.egiz.stal.HashDataInput; -import at.gv.egiz.stal.impl.ByteArrayHashDataInput; -import at.gv.egiz.stal.service.STALPortType; -import at.gv.egiz.stal.service.types.GetHashDataInputResponseType; -import at.gv.egiz.stal.service.types.GetHashDataInputType; -import at.gv.egiz.stal.signedinfo.DigestMethodType; -import at.gv.egiz.stal.signedinfo.ReferenceType; -import java.security.DigestException; -import java.security.MessageDigest; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * - * @author clemens - */ -public class WSSignRequestHandler extends SignRequestHandler { - - private static final Log log = LogFactory.getLog(WSSignRequestHandler.class); - STALPortType stalPort; - String sessId; - - public WSSignRequestHandler(String sessId, STALPortType stalPort) { - if (stalPort == null || sessId == null) { - throw new NullPointerException("STAL port must not be null"); - } - this.sessId = sessId; - this.stalPort = stalPort; - } - - @Override - public List getCashedHashDataInputs(List signedReferences) throws Exception { - - GetHashDataInputType request = new GetHashDataInputType(); - request.setSessionId(sessId); - - HashMap idSignedRefMap = new HashMap(); - for (ReferenceType signedRef : signedReferences) { - //don't get Manifest, QualifyingProperties, ... - if (signedRef.getType() == null) { - String signedRefId = signedRef.getId(); - if (signedRefId != null) { - if (log.isTraceEnabled()) { - log.trace("requesting hashdata input for reference " + signedRefId); - } - idSignedRefMap.put(signedRefId, signedRef); - GetHashDataInputType.Reference ref = new GetHashDataInputType.Reference(); - ref.setID(signedRefId); - request.getReference().add(ref); - - } else { - throw new Exception("Cannot resolve HashDataInput for reference without Id attribute"); - } - } - } - - if (log.isDebugEnabled()) { - log.debug("Calling GetHashDataInput for " + request.getReference().size() + " references in session " + sessId); - } - GetHashDataInputResponseType response = stalPort.getHashDataInput(request); - ArrayList hashDataInputs = new ArrayList(); - - //hashdata inputs returned from service - HashMap idRefMap = new HashMap(); - for (GetHashDataInputResponseType.Reference reference : response.getReference()) { - String id = reference.getID(); - byte[] hdi = reference.getValue(); - if (hdi == null) { - throw new Exception("Did not receive hashdata input for reference " + id); - } - idRefMap.put(id, reference); - } - - for (String signedRefId : idSignedRefMap.keySet()) { - log.info("validating hashdata input for reference " + signedRefId); - - GetHashDataInputResponseType.Reference reference = idRefMap.get(signedRefId); - if (reference == null) { - throw new Exception("No hashdata input for reference " + signedRefId + " returned by service"); - } - -// } -// -// for (GetHashDataInputResponseType.Reference reference : response.getReference()) { -// -// String id = reference.getID(); - byte[] hdi = reference.getValue(); - String mimeType = reference.getMimeType(); - String encoding = reference.getEncoding(); - - if (hdi == null) { - throw new Exception("No hashdata input provided for reference " + signedRefId); - } - if (log.isDebugEnabled()) { - log.debug("Got HashDataInput " + signedRefId + " (" + mimeType + ";" + encoding + ")"); - } - - ReferenceType dsigRef = idSignedRefMap.get(signedRefId); - DigestMethodType dm = dsigRef.getDigestMethod(); - - if (dm == null) { - throw new Exception("Failed to verify digest value for reference " + signedRefId + ": no digest algorithm"); - } - String mdAlg = dm.getAlgorithm(); - if ("http://www.w3.org/2000/09/xmldsig#sha1".equals(mdAlg)) - mdAlg = "SHA-1"; - else if ("http://www.w3.org/2001/04/xmlenc#sha256".equals(mdAlg)) - mdAlg = "SHA-256"; - else if ("http://www.w3.org/2001/04/xmlenc#sha224 ".equals(mdAlg)) - mdAlg = "SHA-224"; - else if ("http://www.w3.org/2001/04/xmldsig-more#sha224 ".equals(mdAlg)) - mdAlg = "SHA-224"; - else if ("http://www.w3.org/2001/04/xmldsig-more#sha384".equals(mdAlg)) - mdAlg = "SHA-384"; - else if ("http://www.w3.org/2001/04/xmlenc#sha512".equals(mdAlg)) - mdAlg = "SHA-512"; - else if ("http://www.w3.org/2001/04/xmldsig-more#md2 ".equals(mdAlg)) - mdAlg = "MD2"; - else if ("http://www.w3.org/2001/04/xmldsig-more#md5".equals(mdAlg)) - mdAlg = "MD5"; - else if ("http://www.w3.org/2001/04/xmlenc#ripemd160 ".equals(mdAlg)) - mdAlg = "RipeMD-160"; - else { - throw new Exception("Failed to verify digest value for reference " + signedRefId + ": unsupported digest algorithm " + mdAlg); - } - MessageDigest md = MessageDigest.getInstance(mdAlg); - byte[] hdiDigest = md.digest(hdi); - if (log.isDebugEnabled()) - log.debug("Comparing digest values... "); - if (!Arrays.equals(hdiDigest, dsigRef.getDigestValue())) { - log.error("digest values differ: " + new String(hdiDigest) + ", " + new String(dsigRef.getDigestValue())); - throw new DigestException("Bad digest value for reference " + signedRefId + ": " + new String(dsigRef.getDigestValue())); - } - hashDataInputs.add(new ByteArrayHashDataInput(hdi, signedRefId, mimeType, encoding)); - } - return hashDataInputs; - } - - @Override - public SMCCSTALRequestHandler newInstance() { - return new WSSignRequestHandler(this.sessId, this.stalPort); - } -} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java new file mode 100644 index 00000000..4a87b8b5 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java @@ -0,0 +1,167 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.online.applet; + +import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; +import at.gv.egiz.bku.smccstal.SignRequestHandler; +import at.gv.egiz.stal.HashDataInput; +import at.gv.egiz.stal.impl.ByteArrayHashDataInput; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.types.GetHashDataInputResponseType; +import at.gv.egiz.stal.service.types.GetHashDataInputType; +import at.gv.egiz.stal.signedinfo.DigestMethodType; +import at.gv.egiz.stal.signedinfo.ReferenceType; +import java.security.DigestException; +import java.security.MessageDigest; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * @author clemens + */ +public class WebServiceSignRequestHandler extends SignRequestHandler { + + private static final Log log = LogFactory.getLog(WebServiceSignRequestHandler.class); + STALPortType stalPort; + String sessId; + + public WebServiceSignRequestHandler(String sessId, STALPortType stalPort) { + if (stalPort == null || sessId == null) { + throw new NullPointerException("STAL port must not be null"); + } + this.sessId = sessId; + this.stalPort = stalPort; + } + + @Override + public void displayHashDataInputs(List signedReferences) throws Exception { + + GetHashDataInputType request = new GetHashDataInputType(); + request.setSessionId(sessId); + + HashMap idSignedRefMap = new HashMap(); + for (ReferenceType signedRef : signedReferences) { + //don't get Manifest, QualifyingProperties, ... + if (signedRef.getType() == null) { + String signedRefId = signedRef.getId(); + if (signedRefId != null) { + if (log.isTraceEnabled()) { + log.trace("requesting hashdata input for reference " + signedRefId); + } + idSignedRefMap.put(signedRefId, signedRef); + GetHashDataInputType.Reference ref = new GetHashDataInputType.Reference(); + ref.setID(signedRefId); + request.getReference().add(ref); + + } else { + throw new Exception("Cannot resolve HashDataInput for reference without Id attribute"); + } + } + } + + if (log.isDebugEnabled()) { + log.debug("Calling GetHashDataInput for " + request.getReference().size() + " references in session " + sessId); + } + GetHashDataInputResponseType response = stalPort.getHashDataInput(request); + ArrayList hashDataInputs = new ArrayList(); + + //hashdata inputs returned from service + HashMap idRefMap = new HashMap(); + for (GetHashDataInputResponseType.Reference reference : response.getReference()) { + String id = reference.getID(); + byte[] hdi = reference.getValue(); + if (hdi == null) { + throw new Exception("Did not receive hashdata input for reference " + id); + } + idRefMap.put(id, reference); + } + + for (String signedRefId : idSignedRefMap.keySet()) { + log.info("validating hashdata input for reference " + signedRefId); + + GetHashDataInputResponseType.Reference reference = idRefMap.get(signedRefId); + if (reference == null) { + throw new Exception("No hashdata input for reference " + signedRefId + " returned by service"); + } + +// } +// +// for (GetHashDataInputResponseType.Reference reference : response.getReference()) { +// +// String id = reference.getID(); + byte[] hdi = reference.getValue(); + String mimeType = reference.getMimeType(); + String encoding = reference.getEncoding(); + + if (hdi == null) { + throw new Exception("No hashdata input provided for reference " + signedRefId); + } + if (log.isDebugEnabled()) { + log.debug("Got HashDataInput " + signedRefId + " (" + mimeType + ";" + encoding + ")"); + } + + ReferenceType dsigRef = idSignedRefMap.get(signedRefId); + DigestMethodType dm = dsigRef.getDigestMethod(); + + if (dm == null) { + throw new Exception("Failed to verify digest value for reference " + signedRefId + ": no digest algorithm"); + } + String mdAlg = dm.getAlgorithm(); + if ("http://www.w3.org/2000/09/xmldsig#sha1".equals(mdAlg)) + mdAlg = "SHA-1"; + else if ("http://www.w3.org/2001/04/xmlenc#sha256".equals(mdAlg)) + mdAlg = "SHA-256"; + else if ("http://www.w3.org/2001/04/xmlenc#sha224 ".equals(mdAlg)) + mdAlg = "SHA-224"; + else if ("http://www.w3.org/2001/04/xmldsig-more#sha224 ".equals(mdAlg)) + mdAlg = "SHA-224"; + else if ("http://www.w3.org/2001/04/xmldsig-more#sha384".equals(mdAlg)) + mdAlg = "SHA-384"; + else if ("http://www.w3.org/2001/04/xmlenc#sha512".equals(mdAlg)) + mdAlg = "SHA-512"; + else if ("http://www.w3.org/2001/04/xmldsig-more#md2 ".equals(mdAlg)) + mdAlg = "MD2"; + else if ("http://www.w3.org/2001/04/xmldsig-more#md5".equals(mdAlg)) + mdAlg = "MD5"; + else if ("http://www.w3.org/2001/04/xmlenc#ripemd160 ".equals(mdAlg)) + mdAlg = "RipeMD-160"; + else { + throw new Exception("Failed to verify digest value for reference " + signedRefId + ": unsupported digest algorithm " + mdAlg); + } + MessageDigest md = MessageDigest.getInstance(mdAlg); + byte[] hdiDigest = md.digest(hdi); + if (log.isDebugEnabled()) + log.debug("Comparing digest values... "); + if (!Arrays.equals(hdiDigest, dsigRef.getDigestValue())) { + log.error("digest values differ: " + new String(hdiDigest) + ", " + new String(dsigRef.getDigestValue())); + throw new DigestException("Bad digest value for reference " + signedRefId + ": " + new String(dsigRef.getDigestValue())); + } + hashDataInputs.add(new ByteArrayHashDataInput(hdi, signedRefId, mimeType, encoding)); + } + + gui.showHashDataInputDialog(hashDataInputs, this, "ok"); + } + + @Override + public SMCCSTALRequestHandler newInstance() { + return new WebServiceSignRequestHandler(this.sessId, this.stalPort); + } +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index 4925e7fa..0b617271 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -30,6 +30,7 @@ public interface BKUGUIFacade { public static final String ERR_NO_PCSC = "error.pcsc"; public static final String ERR_NO_CARDTERMINAL = "error.cardterminal"; public static final String ERR_NO_HASHDATA = "error.no.hashdata"; + public static final String ERR_DISPLAY_HASHDATA = "error.display.hashdata"; public static final String ERR_WRITE_HASHDATA = "error.write.hashdata"; public static final String ERR_INVALID_HASH = "error.invalid.hash"; diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index abed420f..e7716ae9 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -50,6 +50,7 @@ save.hashdatainput.prefix=Signaturdaten # Error Messages error.no.hashdata=Keine Signaturdaten verf\u00FCgbar: {0} +error.display.hashdata=Signaturdaten konnten nicht dargestellt werden: {0} error.write.hashdata=Die Signaturdaten konnten nicht gespeichert werden: {0} error.invalid.hash=Die Signaturdaten sind ung\u00FCltig: {0} error.ws.unreachable=Das Web-Service ist nicht erreichbar: {0} diff --git a/BKUCommonGUI/src/main/resources/images/chipperling_only.png b/BKUCommonGUI/src/main/resources/images/chipperling_only.png new file mode 100644 index 00000000..57063b9a Binary files /dev/null and b/BKUCommonGUI/src/main/resources/images/chipperling_only.png differ diff --git a/BKUCommonGUI/src/main/resources/images/mocca_chipperling.png b/BKUCommonGUI/src/main/resources/images/mocca_chipperling.png new file mode 100644 index 00000000..4ee2d054 Binary files /dev/null and b/BKUCommonGUI/src/main/resources/images/mocca_chipperling.png differ diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java index ca420f13..4330f570 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java @@ -17,6 +17,7 @@ package at.gv.egiz.bku.local.stal; import at.gv.egiz.bku.slcommands.impl.DataObjectHashDataInput; +import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -41,68 +42,92 @@ import java.io.InputStream; */ public class LocalSignRequestHandler extends SignRequestHandler { - private static final Log log = LogFactory - .getLog(LocalSignRequestHandler.class); - private List hashDataInput = Collections.EMPTY_LIST; - - public LocalSignRequestHandler() { - } + private static final Log log = LogFactory.getLog(LocalSignRequestHandler.class); + private List hashDataInputs = Collections.EMPTY_LIST; + /** + * If the request is a SIGN request, it contains a list of DataObjectHashDataInput + * providing the pre-digested input stream (that can be obtained repeatedly) if + * reference caching is enabled (or null otherwise). + * @param request + * @return + */ @SuppressWarnings("unchecked") @Override public STALResponse handleRequest(STALRequest request) { if (request instanceof SignRequest) { SignRequest signReq = (SignRequest) request; - hashDataInput = signReq.getHashDataInput(); + hashDataInputs = signReq.getHashDataInput(); } return super.handleRequest(request); } + /** + * + * @param dsigReferences + * @throws java.lang.Exception + */ @Override - public List getCashedHashDataInputs( - List dsigReferences) throws Exception { - ArrayList result = new ArrayList(); + public void displayHashDataInputs(List dsigReferences) throws Exception { + if (dsigReferences == null || dsigReferences.size() < 1) { + log.error("No hashdata input selected to be displayed: null"); + throw new Exception("No HashData Input selected to be displayed"); + } + + ArrayList selectedHashDataInputs = new ArrayList(); for (ReferenceType dsigRef : dsigReferences) { // don't get Manifest, QualifyingProperties, ... if (dsigRef.getType() == null) { String dsigRefId = dsigRef.getId(); if (dsigRefId != null) { - for (HashDataInput hdi : hashDataInput) { - if (hdi.getReferenceId().equals(dsigRefId)) { - if (hdi instanceof DataObjectHashDataInput) { - if (log.isTraceEnabled()) - log.trace("adding DataObjectHashDataInput"); - result.add(hdi); - } else if (hdi instanceof ByteArrayHashDataInput) { - if (log.isTraceEnabled()) - log.trace("adding ByteArrayHashDataInput"); - result.add(hdi); - } else { - if (log.isDebugEnabled()) - log.debug("provided HashDataInput not chaching enabled, creating ByteArrayHashDataInput"); - - InputStream hdIs = hdi.getHashDataInput(); - ByteArrayOutputStream baos = new ByteArrayOutputStream(hdIs.available()); - int b; - while ((b = hdIs.read()) != -1) { - baos.write(b); - } - ByteArrayHashDataInput baHdi = new ByteArrayHashDataInput(baos.toByteArray(), hdi.getReferenceId(), hdi.getMimeType(), hdi.getEncoding()); - result.add(baHdi); + boolean hdiAvailable = false; + for (HashDataInput hashDataInput : hashDataInputs) { + if (dsigRefId.equals(hashDataInput.getReferenceId())) { + log.debug("display hashdata input for dsig:SignedReference " + dsigRefId); + if (!(hashDataInput instanceof DataObjectHashDataInput)) { + log.warn( + "expected DataObjectHashDataInput for LocalSignRequestHandler, got " + hashDataInput.getClass().getName()); + hashDataInput = getByteArrayHashDataInput(hashDataInput); } + selectedHashDataInputs.add(hashDataInput); + hdiAvailable = true; + break; } } + if (!hdiAvailable) { + log.error("no hashdata input for dsig:SignedReference " + dsigRefId); + throw new Exception( + "No HashDataInput available for dsig:SignedReference " + dsigRefId); + } } else { throw new Exception( - "Cannot get HashDataInput for dsig:Reference without Id attribute"); + "Cannot get HashDataInput for dsig:Reference without Id attribute"); } } } - return result; + + if (selectedHashDataInputs.size() < 1) { + log.error("dsig:SignedInfo does not contain a data reference"); + throw new Exception("dsig:SignedInfo does not contain a data reference"); + } + gui.showHashDataInputDialog(selectedHashDataInputs, this, "ok"); } @Override public SMCCSTALRequestHandler newInstance() { return new LocalSignRequestHandler(); } + + private ByteArrayHashDataInput getByteArrayHashDataInput(HashDataInput hashDataInput) throws IOException { + + InputStream hdIs = hashDataInput.getHashDataInput(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(hdIs.available()); + int b; + while ((b = hdIs.read()) != -1) { + baos.write(b); + } + ByteArrayHashDataInput hdi = new ByteArrayHashDataInput(baos.toByteArray(), hashDataInput.getReferenceId(), hashDataInput.getMimeType(), hashDataInput.getEncoding()); + + return hdi; + } } diff --git a/BKUOnline/src/main/webapp/appletPage.jsp b/BKUOnline/src/main/webapp/appletPage.jsp index 6c4aee58..903c762d 100644 --- a/BKUOnline/src/main/webapp/appletPage.jsp +++ b/BKUOnline/src/main/webapp/appletPage.jsp @@ -53,6 +53,7 @@ var parameters = { background : '<%=backgroundImg%>', WSDL_URL :'../stal?wsdl', + HashDataURL : '../hashDataInput', SessionID : '<%=session.getId()%>', redirectURL : '../bkuResult' }; diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/CashedHashDataInputResolver.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/CashedHashDataInputResolver.java deleted file mode 100644 index 05af85d9..00000000 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/CashedHashDataInputResolver.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -package at.gv.egiz.bku.smccstal; - -import at.gv.egiz.stal.HashDataInput; -import at.gv.egiz.stal.impl.ByteArrayHashDataInput; -import at.gv.egiz.stal.signedinfo.ReferenceType; -import java.security.DigestException; -import java.util.List; -import java.util.Set; - -/** - * - * @author clemens - */ -public interface CashedHashDataInputResolver { - - /** - * implementations may verify the hashvalue - * @post-condition returned list != null - * @return - */ - List getCashedHashDataInputs(List signedReferences) throws DigestException, Exception; -} diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/HashDataInputDisplay.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/HashDataInputDisplay.java new file mode 100644 index 00000000..f79a2027 --- /dev/null +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/HashDataInputDisplay.java @@ -0,0 +1,30 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package at.gv.egiz.bku.smccstal; + +import at.gv.egiz.stal.signedinfo.ReferenceType; +import java.security.DigestException; +import java.util.List; + +/** + * + * @author clemens + */ +public interface HashDataInputDisplay { + + /** + * Displays the hashdata inputs for all provided dsig:SignedReferences. + * Implementations may verify the digest value if necessary. + * (LocalSignRequestHandler operates on DataObjectHashDataInput, + * other SignRequestHandlers should cache the HashDataInputs obtained by webservice calls, + * or simply forward to a HashDataInputServlet.) + * @param signedReferences The caller may select a subset of the references in SignedInfo to be displayed. + * @throws java.security.DigestException if digest values are verified and do not correspond + * (or any other digest computation error occurs) + * @throws java.lang.Exception + */ + void displayHashDataInputs(List signedReferences) throws DigestException, Exception; + +} diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java index 7d994392..dcd12b02 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java @@ -17,6 +17,7 @@ package at.gv.egiz.bku.smccstal; import at.gv.egiz.bku.gui.BKUGUIFacade; +import java.awt.event.ActionEvent; import java.io.ByteArrayInputStream; import java.io.InputStream; import java.security.MessageDigest; @@ -42,31 +43,18 @@ import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; import at.gv.egiz.stal.SignResponse; -import at.gv.egiz.stal.impl.ByteArrayHashDataInput; import at.gv.egiz.stal.signedinfo.ObjectFactory; -import at.gv.egiz.stal.signedinfo.ReferenceType; import at.gv.egiz.stal.signedinfo.SignedInfoType; import at.gv.egiz.stal.util.JCEAlgorithmNames; -import java.io.ByteArrayOutputStream; -import java.io.IOException; +import java.awt.event.ActionListener; import java.security.DigestException; -import java.security.DigestInputStream; -import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Set; -/** - * This class is NOT thread-safe. - * handleRequest() sets the SignedInfo which is used in providePIN. - */ -public abstract class SignRequestHandler extends AbstractRequestHandler implements - CashedHashDataInputResolver { +public abstract class SignRequestHandler extends AbstractRequestHandler implements HashDataInputDisplay { private static Log log = LogFactory.getLog(SignRequestHandler.class); private static JAXBContext jaxbContext; - static { try { jaxbContext = JAXBContext.newInstance(ObjectFactory.class.getPackage().getName()); @@ -74,11 +62,6 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen log.fatal("Cannot init jaxbContext", e); } } - /** the SignedInfo of the current SignRequest */ -// protected SignedInfoType signedInfo; -// protected List hashDataInputs; - -// private int retryCounter = 0; @SuppressWarnings("unchecked") @Override @@ -192,99 +175,10 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen // return new SignRequestHandler(); // } - /** - * implementations may verify the hashvalue - * @post-condition returned list != null - * @return - */ - @Override - public abstract List getCashedHashDataInputs(List signedReferences) throws Exception; -// { -// //TODO -// log.warn("Return empty HashDataInput"); -// return new ArrayList(); -// } - + -// protected void validateHashDataInputs(List signedReferences, List hashDataInputs) { -// if (hashDataInputs != null) { -// -// Map hashDataIdMap = new HashMap(); -// for (HashDataInput hdi : hashDataInputs) { -// if (log.isTraceEnabled()) { -// log.trace("Provided HashDataInput for reference " + hdi.getReferenceId()); -// } -// hashDataIdMap.put(hdi.getReferenceId(), hdi); -// } -// -// List reqRefs = request.getReference(); -// for (GetHashDataInputType.Reference reqRef : reqRefs) { -// String reqRefId = reqRef.getID(); -// HashDataInput reqHdi = hashDataIdMap.get(reqRefId); -// if (reqHdi == null) { -// String msg = "Failed to resolve HashDataInput for reference " + reqRefId; -// log.error(msg); -// GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); -// faultInfo.setErrorCode(1); -// faultInfo.setErrorMessage(msg); -// throw new GetHashDataInputFault(msg, faultInfo); -// } -// -// InputStream hashDataIS = reqHdi.getHashDataInput(); -// if (hashDataIS == null) { -// //HashDataInput not cached? -// String msg = "Failed to obtain HashDataInput for reference " + reqRefId + ", reference not cached"; -// log.error(msg); -// GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); -// faultInfo.setErrorCode(1); -// faultInfo.setErrorMessage(msg); -// throw new GetHashDataInputFault(msg, faultInfo); -// } -// ByteArrayOutputStream baos = null; -// try { -// if (log.isDebugEnabled()) { -// log.debug("Resolved HashDataInput " + reqRefId + " (" + reqHdi.getMimeType() + ";charset=" + reqHdi.getEncoding() + ")"); -// } -// baos = new ByteArrayOutputStream(hashDataIS.available()); -// int c; -// while ((c = hashDataIS.read()) != -1) { -// baos.write(c); -// } -// GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference(); -// ref.setID(reqRefId); -// ref.setMimeType(reqHdi.getMimeType()); -// ref.setEncoding(reqHdi.getEncoding()); -// ref.setValue(baos.toByteArray()); -// response.getReference().add(ref); -// } catch (IOException ex) { -// String msg = "Failed to get HashDataInput for reference " + reqRefId; -// log.error(msg, ex); -// GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); -// faultInfo.setErrorCode(1); -// faultInfo.setErrorMessage(msg); -// throw new GetHashDataInputFault(msg, faultInfo, ex); -// } finally { -// try { -// baos.close(); -// } catch (IOException ex) { -// } -// } -// } -// return response; -// } -// for (ReferenceType reference : signedReferences) { -// String algorithm = reference.getDigestMethod().getAlgorithm(); -// -// } -// } - - - /** - * cashes the HashDataInputs provided by SignRequestHandler.this.getHashDataInputs() - * (don't know whether outer class is LocalSignRequestHandler or WSSignRequestHandler, providing DataObjectHDI or ByteArrayHDI, resp) - */ - class STALPinProvider implements PINProvider { + class STALPinProvider implements PINProvider, ActionListener { protected SignedInfoType signedInfo; protected List hashDataInputs; @@ -293,49 +187,73 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen public STALPinProvider(SignedInfoType signedInfo) { this.signedInfo = signedInfo; } + + private void showSignaturePINDialog(PINSpec spec, int retries) { + if (retryCounter > 0) { + gui.showSignaturePINRetryDialog(spec, retries, SignRequestHandler.this, "sign", SignRequestHandler.this, + "cancel", SignRequestHandler.this, "hashData"); + } else { + gui.showSignaturePINDialog(spec, SignRequestHandler.this, "sign", SignRequestHandler.this, "cancel", SignRequestHandler.this, + "hashData"); + } + } @Override public String providePIN(PINSpec spec, int retries) { - if (retryCounter++ > 0) { - log.info("PIN wrong retrying ..."); - gui.showSignaturePINRetryDialog(spec, retries, SignRequestHandler.this, "sign", SignRequestHandler.this, - "cancel", SignRequestHandler.this, "hashData"); - } else { - gui.showSignaturePINDialog(spec, SignRequestHandler.this, "sign", SignRequestHandler.this, "cancel", SignRequestHandler.this, - "hashData"); - } + + showSignaturePINDialog(spec, retries); + do { waitForAction(); gui.showWaitDialog(null); if (actionCommand.equals("cancel")) { return null; } else if (actionCommand.equals("hashData")) { - if (signedInfo != null) { + + showSignaturePINDialog(spec, retries); + try { -// gui.showWaitDialog(null); - if (hashDataInputs == null || hashDataInputs.size() == 0) { - hashDataInputs = getCashedHashDataInputs(signedInfo.getReference()); - } - gui.showHashDataInputDialog(hashDataInputs, SignRequestHandler.this, "ok"); + displayHashDataInputs(signedInfo.getReference()); } catch (DigestException ex) { log.error("Bad digest value: " + ex.getMessage()); gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH, new Object[] {ex.getMessage()}); } catch (Exception ex) { - //FIXME localize messages - log.error("Failed to obtain HashDataInputs: " + ex.getMessage()); - gui.showErrorDialog(BKUGUIFacade.ERR_NO_HASHDATA, new Object[] {ex.getMessage()}, SignRequestHandler.this, "ok"); + log.error("Could not display hashdata inputs: " + ex.getMessage()); + gui.showErrorDialog(BKUGUIFacade.ERR_DISPLAY_HASHDATA, new Object[] {ex.getMessage()}, SignRequestHandler.this, "ok"); } - } else { - //FIXME get all hashdatainputs - gui.showErrorDialog(BKUGUIFacade.ERR_NO_HASHDATA, new Object[] {"No dsig:SignedInfo provided"}, SignRequestHandler.this, "ok"); - } + + // OLD HASHDATA DISPLAY (in applet), + // register SignRequestHandler.this as hashdataListener to use +// if (signedInfo != null) { +// try { +// if (hashDataInputs == null || hashDataInputs.size() == 0) { +// hashDataInputs = getCashedHashDataInputs(signedInfo.getReference()); +// } +// gui.showHashDataInputDialog(hashDataInputs, SignRequestHandler.this, "ok"); +// } catch (DigestException ex) { +// log.error("Bad digest value: " + ex.getMessage()); +// gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH, new Object[] {ex.getMessage()}); +// } catch (Exception ex) { +// //FIXME localize messages +// log.error("Failed to obtain HashDataInputs: " + ex.getMessage()); +// gui.showErrorDialog(BKUGUIFacade.ERR_NO_HASHDATA, new Object[] {ex.getMessage()}, SignRequestHandler.this, "ok"); +// } +// } else { +// //FIXME get all hashdatainputs +// gui.showErrorDialog(BKUGUIFacade.ERR_NO_HASHDATA, new Object[] {"No dsig:SignedInfo provided"}, SignRequestHandler.this, "ok"); +// } } else if (actionCommand.equals("sign")) { + retryCounter++; return new String(gui.getPin()); } else if (actionCommand.equals("ok")) { - gui.showSignaturePINDialog(spec, SignRequestHandler.this, "sign", SignRequestHandler.this, "cancel", SignRequestHandler.this, - "hashData"); + showSignaturePINDialog(spec, retries); } } while (true); } + + @Override + public void actionPerformed(ActionEvent e) { + throw new UnsupportedOperationException("Not supported yet."); + } } } -- cgit v1.2.3 From 128dc80f2e484b224c131abc8de6fab204d71d19 Mon Sep 17 00:00:00 2001 From: wbauer Date: Mon, 13 Oct 2008 13:23:17 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@106 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'BKUApplet') 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 d5ba4e40..b11413d6 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 @@ -245,7 +245,9 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, log.error(e); } } - signatureCard.disconnect(false); + if (signatureCard != null) { + signatureCard.disconnect(false); + } QuitHandler.getInstance().unregisterHandlerInstance(this); sendRedirect(); } -- cgit v1.2.3 From aa099311111a1d53f999705762aceb4005ecc187 Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 13 Oct 2008 13:59:06 +0000 Subject: config guiStyle simple/advanced, hashdatadisplay internal/external git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@107 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 11 ++++++++-- .../at/gv/egiz/bku/online/applet/BKUWorker.java | 25 +++++++++++++++------- .../online/applet/SignRequestHandlerFactory.java | 21 ------------------ BKUApplet/src/test/resources/appletTest.html | 6 +++++- .../java/at/gv/egiz/bku/gui/BKUGUIFactory.java | 13 ++++++++--- .../at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 2 +- BKUOnline/src/main/webapp/appletPage.jsp | 6 ++++-- 7 files changed, 46 insertions(+), 38 deletions(-) delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/SignRequestHandlerFactory.java (limited to 'BKUApplet') 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 32c4feaa..96c0e7eb 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 @@ -42,13 +42,19 @@ import java.net.URL; 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"; + public static final String HASHDATA_DISPLAY = "HashDataDisplay"; public final static String HASHDATA_URL = "HashDataURL"; public final static String SESSION_ID = "SessionID"; - public static final String BACKGROUND_PARAM = "background"; + public static final String BACKGROUND_PARAM = "Background"; + 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; @@ -78,7 +84,8 @@ public class BKUApplet extends JApplet { log.warn(ex.getMessage() + ", using default background"); } } - BKUGUIFacade gui = BKUGUIFactory.createGUI(); + String guiStyle = getMyAppletParameter(GUI_STYLE); + BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle); gui.init(getContentPane(), localeString, background); worker = new BKUWorker(gui, this, resourceBundle); } 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 b11413d6..350925ce 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 @@ -55,7 +55,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, protected BKUGUIFacade gui; protected BKUApplet parent; private STALPortType stalPort; - private URL hashDataURL; +// private URL hashDataURL; protected List actionCommandList = new ArrayList(); protected Boolean actionPerformed = false; protected boolean finished = false; @@ -140,7 +140,6 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, gui.showWelcomeDialog(); try { stalPort = getSTALPort(); - hashDataURL = getHashDataURL(); } catch (Exception e) { log.fatal("Failed to call STAL service.", e); actionCommandList.clear(); @@ -155,10 +154,10 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, return; } - //TODO factory for SignRequestHandler providing either WebServiceHDISignRequestHandler or ExternalHDIDisplaySignRequestHandler - AppletContext ctx = parent.getAppletContext(); - log.debug("register SignRequestHandler for HashDataURL " + hashDataURL); - addRequestHandler(at.gv.egiz.stal.SignRequest.class, new ExternalDisplaySignRequestHandler(ctx, hashDataURL)); +// //TODO factory for SignRequestHandler providing either WebServiceHDISignRequestHandler or ExternalHDIDisplaySignRequestHandler +// AppletContext ctx = parent.getAppletContext(); +// log.debug("register SignRequestHandler for HashDataURL " + hashDataURL); +// addRequestHandler(at.gv.egiz.stal.SignRequest.class, new ExternalDisplaySignRequestHandler(ctx, hashDataURL)); try { String sessionId = parent.getMyAppletParameter(BKUApplet.SESSION_ID); @@ -167,6 +166,16 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, sessionId = "TestSession"; } + String hashDataDisplayStyle = parent.getMyAppletParameter(BKUApplet.HASHDATA_DISPLAY); + if (BKUApplet.HASHDATA_DISPLAY_INTERNAL.equals(hashDataDisplayStyle)) { + log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL); + addRequestHandler(at.gv.egiz.stal.SignRequest.class, new WebServiceSignRequestHandler(sessionId, stalPort)); + } else { //if (HASHDATADISPLAY_EXTERNAL.equals(displayStyle)) { + URL hashDataURL = getHashDataURL(); + log.debug("register SignRequestHandler for HashDataURL " + hashDataURL); + addRequestHandler(at.gv.egiz.stal.SignRequest.class, new ExternalDisplaySignRequestHandler(parent.getAppletContext(), hashDataURL)); + } + // log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL); // addRequestHandler(at.gv.egiz.stal.SignRequest.class, new WebServiceSignRequestHandler(sessionId, stalPort)); @@ -254,8 +263,8 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, protected void sendRedirect() { log.info("Done, sending redirect to get BKU response"); - String redirectURL = parent.getMyAppletParameter("redirectURL"); - String redirectTarget = parent.getMyAppletParameter("redirectTarget"); + String redirectURL = parent.getMyAppletParameter(BKUApplet.REDIRECT_URL); + String redirectTarget = parent.getMyAppletParameter(BKUApplet.REDIRECT_TARGET); log.info("Redirecting to: " + redirectURL + " target: " + redirectTarget); URL url = null; if (redirectURL != null) { diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/SignRequestHandlerFactory.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/SignRequestHandlerFactory.java deleted file mode 100644 index 327ea8aa..00000000 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/SignRequestHandlerFactory.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -package at.gv.egiz.bku.online.applet; - -import at.gv.egiz.bku.smccstal.SignRequestHandler; - -/** - * - * @author clemens - */ -public class SignRequestHandlerFactory { - - static SignRequestHandler getInstance() { - //TODO return ExternalDisplaySignRequestHandler by default, WebServiceSignRequestHandler if requested - //TODO get configuration as param - return null; - } -} diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html index 5b10d6b5..b8a0770e 100644 --- a/BKUApplet/src/test/resources/appletTest.html +++ b/BKUApplet/src/test/resources/appletTest.html @@ -20,9 +20,13 @@ + + + + - + diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java index 5124914a..4a338f23 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java @@ -17,16 +17,23 @@ package at.gv.egiz.bku.gui; public class BKUGUIFactory { + + public static final String SIMPLE_GUI = "simple"; + public static final String ADVANCED_GUI = "advanced"; + private static BKUGUIFactory instance = new BKUGUIFactory(); private BKUGUIFactory() { } - protected BKUGUIFacade createNewGUI() { + protected BKUGUIFacade createNewGUI(String style) { + if (ADVANCED_GUI.equals(style)) { + return new BKUGUI(); + } return new SimpleGUI(); } - public static BKUGUIFacade createGUI() { - return instance.createNewGUI(); + public static BKUGUIFacade createGUI(String style) { + return instance.createNewGUI(style); } } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java index 0bdff867..c5736648 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java @@ -50,7 +50,7 @@ public class SMCCSTALFactory implements STALFactory { resourceBundle = ResourceBundle.getBundle(BKUApplet.RESOURCE_BUNDLE_BASE); } dialog = new JDialog(); - BKUGUIFacade gui = BKUGUIFactory.createGUI(); + BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI); gui.init(dialog.getContentPane(), locale.toString(), null); stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog, resourceBundle); dialog.setPreferredSize(new Dimension(400, 200)); diff --git a/BKUOnline/src/main/webapp/appletPage.jsp b/BKUOnline/src/main/webapp/appletPage.jsp index 903c762d..950141c4 100644 --- a/BKUOnline/src/main/webapp/appletPage.jsp +++ b/BKUOnline/src/main/webapp/appletPage.jsp @@ -51,11 +51,13 @@ height :<%=height%> }; var parameters = { - background : '<%=backgroundImg%>', + GuiStyle : 'simple', + Background : '<%=backgroundImg%>', WSDL_URL :'../stal?wsdl', + HashDataDisplay : 'external', HashDataURL : '../hashDataInput', SessionID : '<%=session.getId()%>', - redirectURL : '../bkuResult' + RedirectURL : '../bkuResult' }; var version = '1.6.0_02'; deployJava.runApplet(attributes, parameters, version); -- cgit v1.2.3 From de95f8219adf98710992b6716778b174bc2d2fcc Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 13 Oct 2008 16:43:46 +0000 Subject: BKUGUI / SimpleGUI aligned git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@109 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/src/test/resources/appletTest.html | 2 +- .../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 112 +++------------------ .../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 104 +++---------------- 3 files changed, 26 insertions(+), 192 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html index b8a0770e..472000de 100644 --- a/BKUApplet/src/test/resources/appletTest.html +++ b/BKUApplet/src/test/resources/appletTest.html @@ -20,7 +20,7 @@ - + diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java index 53ec1088..64cd9f50 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java @@ -67,7 +67,7 @@ public class BKUGUI implements BKUGUIFacade { private static final Log log = LogFactory.getLog(BKUGUI.class); public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages"; - public static final String LOGO_RESOURCE = "/images/logo.png"; + public static final String DEFAULT_BACKGROUND = "/images/mocca_default.png"; //logo.png"; public static final String HASHDATA_FONT = "Monospaced"; public static final Color ERROR_COLOR = Color.RED; public static final Color HYPERLINK_COLOR = Color.BLUE; @@ -192,11 +192,19 @@ public class BKUGUI implements BKUGUIFacade { protected void initContentPanel(URL background) { - contentPanel = new JPanel(); + if (background == null) { + background = this.getClass().getResource(DEFAULT_BACKGROUND); + } + contentPanel = new ImagePanel(background); +// contentPanel.setBorder(new TitledBorder("content")); + // headerPanel = new JPanel(); - mainPanel = new JPanel(); - buttonPanel = new JPanel(); +// headerPanel.setOpaque(false); +// mainPanel = new JPanel(); +// mainPanel.setOpaque(false); +// buttonPanel = new JPanel(); +// buttonPanel.setOpaque(false); // headerPanel.setBorder(new TitledBorder("header")); // mainPanel.setBorder(new TitledBorder("main")); @@ -389,16 +397,12 @@ public class BKUGUI implements BKUGUIFacade { GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); -// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton); buttonPanelLayout.setHorizontalGroup( buttonPanelLayout.createSequentialGroup() -// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) -// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); buttonPanelLayout.setVerticalGroup( buttonPanelLayout.createSequentialGroup() -// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(cancelButton)); contentPanel.validate(); @@ -452,16 +456,12 @@ public class BKUGUI implements BKUGUIFacade { GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); -// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton); buttonPanelLayout.setHorizontalGroup( buttonPanelLayout.createSequentialGroup() -// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) -// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); buttonPanelLayout.setVerticalGroup( buttonPanelLayout.createSequentialGroup() -// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(cancelButton)); contentPanel.validate(); @@ -522,8 +522,8 @@ public class BKUGUI implements BKUGUIFacade { }); JLabel infoLabel = new JLabel(); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); if (numRetries < 0) { - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); String pinsizePattern = messages.getString(LABEL_PINSIZE); String pinSize = String.valueOf(pinSpec.getMinLength()); if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { @@ -593,7 +593,6 @@ public class BKUGUI implements BKUGUIFacade { GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); -// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton); buttonPanelLayout.setHorizontalGroup( buttonPanelLayout.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -738,7 +737,6 @@ public class BKUGUI implements BKUGUIFacade { GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); -// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton); buttonPanelLayout.setHorizontalGroup( buttonPanelLayout.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -844,16 +842,12 @@ public class BKUGUI implements BKUGUIFacade { GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); -// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton); buttonPanelLayout.setHorizontalGroup( buttonPanelLayout.createSequentialGroup() -// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) -// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); buttonPanelLayout.setVerticalGroup( buttonPanelLayout.createSequentialGroup() -// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(okButton)); contentPanel.validate(); @@ -1068,7 +1062,6 @@ public class BKUGUI implements BKUGUIFacade { GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); - // buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton); buttonPanelLayout.setHorizontalGroup( buttonPanelLayout.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -1211,7 +1204,6 @@ public class BKUGUI implements BKUGUIFacade { GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); - // buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton); buttonPanelLayout.setHorizontalGroup( buttonPanelLayout.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) @@ -1343,82 +1335,4 @@ public class BKUGUI implements BKUGUIFacade { } } } - -// private String parseToken(final char[] terminators) { -// char ch; -// i1 = pos; -// i2 = pos; -// while (hasChar()) { -// ch = chars[pos]; -// if (isOneOf(ch, terminators)) { -// break; -// } -// i2++; -// pos++; -// } -// return getToken(false); -// } - -// private static String getCharset(String contentType) { -// -// StringTokenizer t = new StringTokenizer -// -// if (contentType == null) { -// return "UTF-8"; -// } -// -// int pos = 0; -// int len = contentType.length(); -// -// while (pos < len) { -// pos++; -// String paramName = parseToken(new char[] { -// '=', separator }); -// } -// -// HashMap params = new HashMap(); -// this.chars = chars; -// this.pos = offset; -// this.len = length; -// -// String paramName = null; -// String paramValue = null; -// while (hasChar()) { -// paramName = parseToken(new char[] { -// '=', separator }); -// paramValue = null; -// if (hasChar() && (chars[pos] == '=')) { -// pos++; // skip '=' -// paramValue = parseQuotedToken(new char[] { -// separator }); -// } -// if (hasChar() && (chars[pos] == separator)) { -// pos++; // skip separator -// } -// if ((paramName != null) && (paramName.length() > 0)) { -// if (this.lowerCaseNames) { -// paramName = paramName.toLowerCase(); -// } -// params.put(paramName, paramValue); -// } -// } -// return params; -// -// -// -// Parser -// ParameterParser pf = new ParameterParser(); -// pf.setLowerCaseNames(true); -// Map map = pf.parse(contentType, SEPERATOR); -// String retVal = (String) map.get(CHAR_SET); -// if ((retVal == null) && (replaceNullWithDefault)) { -// if (map.containsKey(APPLICATION_URL_ENCODED)) { -// // default charset for url encoded data -// return "UTF-8"; -// } -// retVal = getDefaultCharset(); -// } -// return retVal; -// } - } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java index 8e32d67e..e323d195 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java @@ -54,7 +54,6 @@ import javax.swing.JTable; import javax.swing.JTextArea; import javax.swing.LayoutStyle; import javax.swing.SwingUtilities; -import javax.swing.border.TitledBorder; import javax.swing.table.TableColumn; import javax.swing.table.TableModel; import org.apache.commons.logging.Log; @@ -196,14 +195,15 @@ public class SimpleGUI implements BKUGUIFacade { if (background == null) { background = this.getClass().getResource(DEFAULT_BACKGROUND); } - contentPanel = new ImagePanel(background); + contentPanel = new ImagePanel(background); // contentPanel.setBorder(new TitledBorder("content")); // headerPanel = new JPanel(); +// headerPanel.setOpaque(false); mainPanel = new JPanel(); mainPanel.setOpaque(false); - buttonPanel = new JPanel(); // new ImagePanel(LOGO_RESOURCE); //new JPanel(); + buttonPanel = new JPanel(); buttonPanel.setOpaque(false); // headerPanel.setBorder(new TitledBorder("header")); @@ -570,13 +570,12 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) //)) - .addComponent(infoLabel)); + mainPanelLayout.createSequentialGroup() + .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //)) + .addComponent(infoLabel))); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() @@ -589,7 +588,6 @@ public class SimpleGUI implements BKUGUIFacade { .addComponent(infoLabel)); // .addGap(signPinLabel.getFont().getSize())); - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); @@ -731,9 +729,9 @@ public class SimpleGUI implements BKUGUIFacade { .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addComponent(infoLabel)); + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(infoLabel)))); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() @@ -1384,82 +1382,4 @@ public class SimpleGUI implements BKUGUIFacade { } } } - -// private String parseToken(final char[] terminators) { -// char ch; -// i1 = pos; -// i2 = pos; -// while (hasChar()) { -// ch = chars[pos]; -// if (isOneOf(ch, terminators)) { -// break; -// } -// i2++; -// pos++; -// } -// return getToken(false); -// } - -// private static String getCharset(String contentType) { -// -// StringTokenizer t = new StringTokenizer -// -// if (contentType == null) { -// return "UTF-8"; -// } -// -// int pos = 0; -// int len = contentType.length(); -// -// while (pos < len) { -// pos++; -// String paramName = parseToken(new char[] { -// '=', separator }); -// } -// -// HashMap params = new HashMap(); -// this.chars = chars; -// this.pos = offset; -// this.len = length; -// -// String paramName = null; -// String paramValue = null; -// while (hasChar()) { -// paramName = parseToken(new char[] { -// '=', separator }); -// paramValue = null; -// if (hasChar() && (chars[pos] == '=')) { -// pos++; // skip '=' -// paramValue = parseQuotedToken(new char[] { -// separator }); -// } -// if (hasChar() && (chars[pos] == separator)) { -// pos++; // skip separator -// } -// if ((paramName != null) && (paramName.length() > 0)) { -// if (this.lowerCaseNames) { -// paramName = paramName.toLowerCase(); -// } -// params.put(paramName, paramValue); -// } -// } -// return params; -// -// -// -// Parser -// ParameterParser pf = new ParameterParser(); -// pf.setLowerCaseNames(true); -// Map map = pf.parse(contentType, SEPERATOR); -// String retVal = (String) map.get(CHAR_SET); -// if ((retVal == null) && (replaceNullWithDefault)) { -// if (map.containsKey(APPLICATION_URL_ENCODED)) { -// // default charset for url encoded data -// return "UTF-8"; -// } -// retVal = getDefaultCharset(); -// } -// return retVal; -// } - } -- cgit v1.2.3 From 11411c3d236e10b237ec1c7a1904e64dc2508551 Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 14 Oct 2008 14:47:06 +0000 Subject: GUI retry error msg git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@115 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/pom.xml | 7 + .../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 143 ++++++++------------- .../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 38 ++++++ .../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 138 ++++++++------------ .../at/gv/egiz/bku/gui/Messages.properties | 1 + .../gv/egiz/stal/service/impl/STALServiceImpl.java | 10 +- 6 files changed, 164 insertions(+), 173 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml index 130749c5..a20a613d 100644 --- a/BKUApplet/pom.xml +++ b/BKUApplet/pom.xml @@ -103,6 +103,13 @@ + + org.apache.maven.plugins + maven-surefire-plugin + + true + + diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java index 9cba293a..7e0f0447 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java @@ -22,7 +22,6 @@ package at.gv.egiz.bku.gui; import at.gv.egiz.smcc.PINSpec; import at.gv.egiz.stal.HashDataInput; -import java.awt.Color; import java.awt.Container; import java.awt.Cursor; import java.awt.Font; @@ -66,40 +65,7 @@ import org.apache.commons.logging.LogFactory; public class BKUGUI implements BKUGUIFacade { private static final Log log = LogFactory.getLog(BKUGUI.class); - public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages"; - public static final String DEFAULT_BACKGROUND = "/images/mocca_default.png"; //logo.png"; - public static final String HASHDATA_FONT = "Monospaced"; - public static final Color ERROR_COLOR = Color.RED; - public static final Color HYPERLINK_COLOR = Color.BLUE; - private static final String TITLE_WELCOME = "title.welcome"; - private static final String TITLE_INSERTCARD = "title.insertcard"; - private static final String TITLE_CARD_NOT_SUPPORTED = "title.cardnotsupported"; - private static final String TITLE_CARDPIN = "title.cardpin"; - private static final String TITLE_SIGN = "title.sign"; - private static final String TITLE_ERROR = "title.error"; - private static final String TITLE_RETRY = "title.retry"; - private static final String TITLE_WAIT = "title.wait"; - private static final String TITLE_HASHDATA = "title.hashdata"; - private static final String WINDOWTITLE_SAVE = "windowtitle.save"; - private static final String WINDOWTITLE_SAVEDIR = "windowtitle.savedir"; - private static final String WINDOWTITLE_OVERWRITE = "windowtitle.overwrite"; - private static final String MESSAGE_WAIT = "message.wait"; - private static final String MESSAGE_INSERTCARD = "message.insertcard"; - private static final String MESSAGE_HASHDATALINK = "message.hashdatalink"; - private static final String MESSAGE_HASHDATA = "message.hashdata"; - private static final String MESSAGE_HASHDATALIST = "message.hashdatalist"; - private static final String MESSAGE_RETRIES = "message.retries"; - private static final String MESSAGE_OVERWRITE = "message.overwrite"; - private static final String LABEL_PIN = "label.pin"; - private static final String LABEL_PINSIZE = "label.pinsize"; -// private static final String ERROR_NO_HASHDATA = "error.no.hashdata"; - private static final String BUTTON_OK = "button.ok"; - private static final String BUTTON_CANCEL = "button.cancel"; - private static final String BUTTON_BACK = "button.back"; - private static final String BUTTON_SIGN = "button.sign"; - private static final String BUTTON_SAVE = "button.save"; - private static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix"; protected Container contentPane; protected ResourceBundle messages; /** left and right side main panels */ @@ -506,42 +472,47 @@ public class BKUGUI implements BKUGUIFacade { }); JLabel infoLabel = new JLabel(); - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); if (numRetries < 0) { - String pinsizePattern = messages.getString(LABEL_PINSIZE); - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } - infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + String infoPattern = messages.getString(MESSAGE_ENTERPIN); + infoLabel.setText(MessageFormat.format(infoPattern, new Object[] {pinSpec.getLocalizedName()})); } else { - infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); - infoLabel.setForeground(ERROR_COLOR); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD)); + infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); + infoLabel.setForeground(ERROR_COLOR); + } + + JLabel pinsizeLabel = new JLabel(); + pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, pinsizeLabel.getFont().getSize()-2)); + String pinsizePattern = messages.getString(LABEL_PINSIZE); + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); } + pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() -// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) -// .addComponent(hashDataLabel) -// .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() - .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //)) - .addComponent(infoLabel))); + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //)) + .addComponent(pinsizeLabel)))); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() -// .addComponent(hashDataLabel) -// .addGap(hashDataLabel.getFont().getSize()) + .addComponent(infoLabel) + .addGap(infoLabel.getFont().getSize()) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(cardPinLabel) .addComponent(pinField)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(infoLabel)); + .addComponent(pinsizeLabel)); GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); @@ -634,57 +605,57 @@ public class BKUGUI implements BKUGUIFacade { } }); - //pinsize or error label + JLabel pinsizeLabel = new JLabel(); + pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, pinsizeLabel.getFont().getSize()-2)); + String pinsizePattern = messages.getString(LABEL_PINSIZE); + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); + } + pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); + JLabel infoLabel = new JLabel(); - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); if (numRetries < 0) { - String pinsizePattern = messages.getString(LABEL_PINSIZE); - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } - infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + infoLabel.setText(messages.getString(MESSAGE_HASHDATALINK)); + infoLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + infoLabel.setForeground(HYPERLINK_COLOR); + infoLabel.addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent me) { + ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand); + hashdataListener.actionPerformed(e); + } + }); } else { - infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); - infoLabel.setForeground(ERROR_COLOR); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD)); + infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); + infoLabel.setForeground(ERROR_COLOR); } - JLabel hashDataLabel = new JLabel(); - hashDataLabel.setFont(hashDataLabel.getFont().deriveFont(hashDataLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - hashDataLabel.setText(messages.getString(MESSAGE_HASHDATALINK)); - hashDataLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - hashDataLabel.setForeground(HYPERLINK_COLOR); - hashDataLabel.addMouseListener(new MouseAdapter() { - - @Override - public void mouseClicked(MouseEvent me) { - ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand); - hashdataListener.actionPerformed(e); - } - }); - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(hashDataLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() + .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGroup(mainPanelLayout.createSequentialGroup() .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(infoLabel)))); + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pinsizeLabel)))); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(hashDataLabel) - .addGap(hashDataLabel.getFont().getSize()) + .addComponent(infoLabel) + .addGap(infoLabel.getFont().getSize()) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(signPinLabel) .addComponent(pinField)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(infoLabel)); + .addComponent(pinsizeLabel)); GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index 0b617271..a5b7d606 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -18,6 +18,7 @@ package at.gv.egiz.bku.gui; import at.gv.egiz.stal.HashDataInput; import at.gv.egiz.smcc.PINSpec; +import java.awt.Color; import java.awt.Container; import java.awt.event.ActionListener; import java.net.URL; @@ -34,6 +35,43 @@ public interface BKUGUIFacade { public static final String ERR_WRITE_HASHDATA = "error.write.hashdata"; public static final String ERR_INVALID_HASH = "error.invalid.hash"; + public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages"; + public static final String DEFAULT_BACKGROUND = "/images/mocca_default.png"; //logo.png"; + public static final String HASHDATA_FONT = "Monospaced"; + public static final Color ERROR_COLOR = Color.RED; + public static final Color HYPERLINK_COLOR = Color.BLUE; + public static final String TITLE_WELCOME = "title.welcome"; + public static final String TITLE_INSERTCARD = "title.insertcard"; + public static final String TITLE_CARD_NOT_SUPPORTED = "title.cardnotsupported"; + public static final String TITLE_CARDPIN = "title.cardpin"; + public static final String TITLE_SIGN = "title.sign"; + public static final String TITLE_ERROR = "title.error"; + public static final String TITLE_RETRY = "title.retry"; + public static final String TITLE_WAIT = "title.wait"; + public static final String TITLE_HASHDATA = "title.hashdata"; + public static final String WINDOWTITLE_SAVE = "windowtitle.save"; + public static final String WINDOWTITLE_SAVEDIR = "windowtitle.savedir"; + public static final String WINDOWTITLE_OVERWRITE = "windowtitle.overwrite"; + public static final String MESSAGE_WAIT = "message.wait"; + public static final String MESSAGE_INSERTCARD = "message.insertcard"; + public static final String MESSAGE_ENTERPIN = "message.enterpin"; + public static final String MESSAGE_HASHDATALINK = "message.hashdatalink"; + public static final String MESSAGE_HASHDATA = "message.hashdata"; + public static final String MESSAGE_HASHDATALIST = "message.hashdatalist"; + public static final String MESSAGE_RETRIES = "message.retries"; + public static final String MESSAGE_OVERWRITE = "message.overwrite"; + public static final String LABEL_PIN = "label.pin"; + public static final String LABEL_PINSIZE = "label.pinsize"; +// public static final String ERROR_NO_HASHDATA = "error.no.hashdata"; + + public static final String BUTTON_OK = "button.ok"; + public static final String BUTTON_CANCEL = "button.cancel"; + public static final String BUTTON_BACK = "button.back"; + public static final String BUTTON_SIGN = "button.sign"; + public static final String BUTTON_SAVE = "button.save"; + public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix"; + + public void init(Container contentPane, String localeString, URL background); public void showWelcomeDialog(); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java index 3d47e1cd..c37704e2 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java @@ -22,7 +22,6 @@ package at.gv.egiz.bku.gui; import at.gv.egiz.smcc.PINSpec; import at.gv.egiz.stal.HashDataInput; -import java.awt.Color; import java.awt.Container; import java.awt.Cursor; import java.awt.Font; @@ -66,40 +65,7 @@ import org.apache.commons.logging.LogFactory; public class SimpleGUI implements BKUGUIFacade { private static final Log log = LogFactory.getLog(SimpleGUI.class); - public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages"; - public static final String DEFAULT_BACKGROUND = "/images/mocca_default.png"; //logo.png"; - public static final String HASHDATA_FONT = "Monospaced"; - public static final Color ERROR_COLOR = Color.RED; - public static final Color HYPERLINK_COLOR = Color.BLUE; - private static final String TITLE_WELCOME = "title.welcome"; - private static final String TITLE_INSERTCARD = "title.insertcard"; - private static final String TITLE_CARD_NOT_SUPPORTED = "title.cardnotsupported"; - private static final String TITLE_CARDPIN = "title.cardpin"; - private static final String TITLE_SIGN = "title.sign"; - private static final String TITLE_ERROR = "title.error"; - private static final String TITLE_RETRY = "title.retry"; - private static final String TITLE_WAIT = "title.wait"; - private static final String TITLE_HASHDATA = "title.hashdata"; - private static final String WINDOWTITLE_SAVE = "windowtitle.save"; - private static final String WINDOWTITLE_SAVEDIR = "windowtitle.savedir"; - private static final String WINDOWTITLE_OVERWRITE = "windowtitle.overwrite"; - private static final String MESSAGE_WAIT = "message.wait"; - private static final String MESSAGE_INSERTCARD = "message.insertcard"; - private static final String MESSAGE_HASHDATALINK = "message.hashdatalink"; - private static final String MESSAGE_HASHDATA = "message.hashdata"; - private static final String MESSAGE_HASHDATALIST = "message.hashdatalist"; - private static final String MESSAGE_RETRIES = "message.retries"; - private static final String MESSAGE_OVERWRITE = "message.overwrite"; - private static final String LABEL_PIN = "label.pin"; - private static final String LABEL_PINSIZE = "label.pinsize"; -// private static final String ERROR_NO_HASHDATA = "error.no.hashdata"; - private static final String BUTTON_OK = "button.ok"; - private static final String BUTTON_CANCEL = "button.cancel"; - private static final String BUTTON_BACK = "button.back"; - private static final String BUTTON_SIGN = "button.sign"; - private static final String BUTTON_SAVE = "button.save"; - private static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix"; protected Container contentPane; protected ResourceBundle messages; /** left and right side main panels */ @@ -507,39 +473,47 @@ public class SimpleGUI implements BKUGUIFacade { }); JLabel infoLabel = new JLabel(); - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD, infoLabel.getFont().getSize()-2)); if (numRetries < 0) { - String pinsizePattern = messages.getString(LABEL_PINSIZE); - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } - infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + String infoPattern = messages.getString(MESSAGE_ENTERPIN); + infoLabel.setText(MessageFormat.format(infoPattern, new Object[] {pinSpec.getLocalizedName()})); } else { - infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); - infoLabel.setForeground(ERROR_COLOR); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD)); + infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); + infoLabel.setForeground(ERROR_COLOR); + } + + JLabel pinsizeLabel = new JLabel(); + pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, pinsizeLabel.getFont().getSize()-2)); + String pinsizePattern = messages.getString(LABEL_PINSIZE); + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); } + pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() - .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //)) - .addComponent(infoLabel))); + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //)) + .addComponent(pinsizeLabel)))); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() -// .addComponent(hashDataLabel) -// .addGap(hashDataLabel.getFont().getSize()) + .addComponent(infoLabel) + .addGap(infoLabel.getFont().getSize()) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(cardPinLabel) .addComponent(pinField)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(infoLabel)); + .addComponent(pinsizeLabel)); GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); @@ -644,57 +618,57 @@ public class SimpleGUI implements BKUGUIFacade { } }); - //pinsize or error label + JLabel pinsizeLabel = new JLabel(); + pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, pinsizeLabel.getFont().getSize()-2)); + String pinsizePattern = messages.getString(LABEL_PINSIZE); + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); + } + pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); + JLabel infoLabel = new JLabel(); - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD, infoLabel.getFont().getSize()-2)); if (numRetries < 0) { - String pinsizePattern = messages.getString(LABEL_PINSIZE); - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } - infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + infoLabel.setText(messages.getString(MESSAGE_HASHDATALINK)); + infoLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + infoLabel.setForeground(HYPERLINK_COLOR); + infoLabel.addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent me) { + ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand); + hashdataListener.actionPerformed(e); + } + }); } else { - infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); - infoLabel.setForeground(ERROR_COLOR); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD)); + infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); + infoLabel.setForeground(ERROR_COLOR); } - JLabel hashDataLabel = new JLabel(); - hashDataLabel.setFont(hashDataLabel.getFont().deriveFont(hashDataLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - hashDataLabel.setText(messages.getString(MESSAGE_HASHDATALINK)); - hashDataLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - hashDataLabel.setForeground(HYPERLINK_COLOR); - hashDataLabel.addMouseListener(new MouseAdapter() { - - @Override - public void mouseClicked(MouseEvent me) { - ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand); - hashdataListener.actionPerformed(e); - } - }); - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(hashDataLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() + .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGroup(mainPanelLayout.createSequentialGroup() .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(infoLabel)))); + .addComponent(pinsizeLabel)))); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(hashDataLabel) - .addGap(hashDataLabel.getFont().getSize()) + .addComponent(infoLabel) + .addGap(infoLabel.getFont().getSize()) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(signPinLabel) .addComponent(pinField)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(infoLabel)); + .addComponent(pinsizeLabel)); GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index e7716ae9..d0e4726e 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -27,6 +27,7 @@ windowtitle.savedir=Signaturdaten in Verzeichnis speichern windowtitle.overwrite=Datei \u00FCberschreiben? message.wait=Bitte warten... message.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken +message.enterpin=Bitte {0} eingeben message.hashdatalink=Signaturdaten anzeigen... message.hashdata=Ein Signaturdatenobjekt: #message.hashdata=Referenz Id: {0} diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java index 55e66685..99398fe6 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java @@ -314,15 +314,15 @@ public class STALServiceImpl implements STALPortType { log.info("Received TestSession GetNextRequest(ErrorResponse), returning QuitRequest"); response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(new QuitRequestType()); } else { - log.info("Received TestSession GetNextRequest, returning InfoboxReadRequest "); - SignRequestType sig = new SignRequestType(); - sig.setKeyIdentifier("SecureSignatureKeypair"); - sig.setSignedInfo(" id('signed-data-object-0-1214921968-27971781-13578')/node() H1IePEEfGQ2SG03H6LTzw1TpCuM=yV6Q+I60buqR4mMaxA7fi+CV35A=".getBytes()); - response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(sig); + log.info("Received TestSession GetNextRequest, returning SignRequest and 3 InfoboxReadRequests "); InfoboxReadRequestType req = new InfoboxReadRequestType(); req.setInfoboxIdentifier("IdentityLink"); req.setDomainIdentifier("hansiwurzel"); response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(req); + SignRequestType sig = new SignRequestType(); + sig.setKeyIdentifier("SecureSignatureKeypair"); + sig.setSignedInfo(" id('signed-data-object-0-1214921968-27971781-13578')/node() H1IePEEfGQ2SG03H6LTzw1TpCuM=yV6Q+I60buqR4mMaxA7fi+CV35A=".getBytes()); + response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(sig); req = new InfoboxReadRequestType(); req.setInfoboxIdentifier("CertifiedKeypair"); response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(req); -- cgit v1.2.3 From d56504bc815d41ac9142967915b7e6224c2cf529 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 15 Oct 2008 13:41:21 +0000 Subject: remove hashdatainputproxy git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@119 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUWorker.java | 5 ---- .../gv/egiz/stal/impl/ByteArrayHashDataInput.java | 31 ++++++++++++++++++++++ .../at/gv/egiz/bku/gui/Messages.properties | 2 +- .../stal/service/impl/STALRequestBrokerImpl.java | 9 +++---- .../at/gv/egiz/stal/util/HashDataInputProxy.java | 2 +- 5 files changed, 36 insertions(+), 13 deletions(-) (limited to 'BKUApplet') 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 350925ce..3f64de3d 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 @@ -154,11 +154,6 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, return; } -// //TODO factory for SignRequestHandler providing either WebServiceHDISignRequestHandler or ExternalHDIDisplaySignRequestHandler -// AppletContext ctx = parent.getAppletContext(); -// log.debug("register SignRequestHandler for HashDataURL " + hashDataURL); -// addRequestHandler(at.gv.egiz.stal.SignRequest.class, new ExternalDisplaySignRequestHandler(ctx, hashDataURL)); - try { String sessionId = parent.getMyAppletParameter(BKUApplet.SESSION_ID); if (sessionId == null) { diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java b/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java index b0285345..2b5ee7e7 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java @@ -7,7 +7,11 @@ package at.gv.egiz.stal.impl; import at.gv.egiz.stal.HashDataInput; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.InputStream; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * @@ -15,6 +19,8 @@ import java.io.InputStream; */ public class ByteArrayHashDataInput implements HashDataInput { + private static final Log log = LogFactory.getLog(ByteArrayHashDataInput.class); + protected byte[] hashData; protected String id; protected String mimeType; @@ -30,6 +36,31 @@ public class ByteArrayHashDataInput implements HashDataInput { this.encoding = encoding; } + /** + * caches the hashdata input's stream + * @param hdi to be cached + */ + public ByteArrayHashDataInput(HashDataInput hdi) { + if (hdi == null) { + throw new NullPointerException("HashDataInput not provided."); + } + InputStream is = hdi.getHashDataInput(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + try { + byte[] buffer = new byte[1024]; + for (int i = is.read(buffer); i > -1; i = is.read(buffer)) { + baos.write(buffer, 0, i); + } + this.hashData = baos.toByteArray(); + } catch (IOException ex) { + log.error("Failed to cache provided HashDataInput: " + ex.getMessage(), ex); + this.hashData = new byte[0]; + } + this.id = hdi.getReferenceId(); + this.mimeType = hdi.getMimeType(); + this.encoding = hdi.getEncoding(); + } + @Override public String getReferenceId() { return id; diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index d0e4726e..a38e2cf8 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -35,7 +35,7 @@ message.hashdatalist={0} Signaturdatenobjekte: message.retries=Noch {0} Versuch(e) message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben? label.pin={0}: -label.pinsize={0} stellig +label.pinsize=({0} stellig) button.ok=OK button.cancel=Abbrechen button.back=Zur\u00FCck diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java index 03c7c601..7f4a9273 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java @@ -32,7 +32,6 @@ import at.gv.egiz.stal.service.types.QuitRequestType; import at.gv.egiz.stal.service.types.RequestType; import at.gv.egiz.stal.service.types.ResponseType; import at.gv.egiz.stal.service.types.SignRequestType; -import at.gv.egiz.stal.util.HashDataInputProxy; import at.gv.egiz.stal.util.STALTranslator; import java.util.ArrayList; import java.util.Collections; @@ -42,7 +41,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** - * An instance of STALRequestBroker is shared between a producer threads (SLCommand) + * An instance of STALRequestBroker is shared between a producer thread (SLCommand) * and multiple consumer threads (STALService). * This implementation assures that handleRequest is executed only once the previous invocation returned. * The BindingProcessor assures that a new SLCommand calls handleRequest() only once @@ -109,10 +108,8 @@ public class STALRequestBrokerImpl implements STALRequestBroker { req.setKeyIdentifier(((SignRequest) stalRequest).getKeyIdentifier()); req.setSignedInfo(((SignRequest) stalRequest).getSignedInfo()); requests.add(req); - for (HashDataInput hdi : ((SignRequest) stalRequest).getHashDataInput()) { - hashDataInputs.add(new HashDataInputProxy(hdi)); - } - //hashDataInputs.addAll(((SignRequest) stalRequest).getHashDataInput()); + //DataObjectHashDataInput with reference caching enabled DataObject + hashDataInputs.addAll(((SignRequest) stalRequest).getHashDataInput()); break; } else if (stalRequest instanceof InfoboxReadRequest) { log.trace("Received InfoboxReadRequest"); diff --git a/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java b/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java index dda20968..01d207d2 100644 --- a/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java +++ b/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java @@ -13,7 +13,7 @@ import at.gv.egiz.stal.HashDataInput; /** * Enables multiple read requests. - * + * @deprecated use at.gv.egiz.stal.impl.ByteArrayHashDataInput */ public class HashDataInputProxy implements HashDataInput { -- cgit v1.2.3 From ef8dc449ddc60008bce9264c73b4162cc487c174 Mon Sep 17 00:00:00 2001 From: wbauer Date: Thu, 16 Oct 2008 07:51:13 +0000 Subject: Changed STAL Handler from static registration to one Object per STAL instance git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@121 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 8 +--- .../at/gv/egiz/bku/online/applet/BKUWorker.java | 17 +++----- .../applet/ExternalDisplaySignRequestHandler.java | 12 ++---- .../bku/online/applet/MultiInstanceHandler.java | 49 ---------------------- .../at/gv/egiz/bku/online/applet/QuitHandler.java | 37 ---------------- .../applet/WebServiceSignRequestHandler.java | 24 +++++------ .../bku/local/stal/LocalSignRequestHandler.java | 5 --- .../java/at/gv/egiz/bku/local/stal/SMCCSTAL.java | 2 +- .../at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 5 +-- .../java/at/gv/egiz/bku/local/app/BKULauncher.java | 2 - .../at/gv/egiz/smcc/AbstractSignatureCard.java | 2 +- .../main/java/at/gv/egiz/smcc/util/SMCCHelper.java | 6 +-- .../at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java | 21 ++++------ .../bku/smccstal/InfoBoxReadRequestHandler.java | 5 --- .../egiz/bku/smccstal/SMCCSTALRequestHandler.java | 2 - 15 files changed, 35 insertions(+), 162 deletions(-) delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/MultiInstanceHandler.java delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/QuitHandler.java (limited to 'BKUApplet') 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 96c0e7eb..97b5869f 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 @@ -17,11 +17,10 @@ package at.gv.egiz.bku.online.applet; import java.net.MalformedURLException; +import java.net.URL; import java.util.Locale; import java.util.ResourceBundle; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.net.ssl.HttpsURLConnection; import javax.swing.JApplet; @@ -30,10 +29,6 @@ import org.apache.commons.logging.LogFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIFactory; -import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; -import at.gv.egiz.stal.QuitRequest; - -import java.net.URL; /** * Note: all swing code is executed by the event dispatch thread (see @@ -66,7 +61,6 @@ public class BKUApplet extends JApplet { public void init() { log.info("Welcome to MOCCA\n"); log.debug("Called init()"); - AbstractSMCCSTAL.addRequestHandler(QuitRequest.class, QuitHandler.getInstance()); HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance()); String localeString = getMyAppletParameter(LOCALE_PARAM_KEY); if (localeString != null) { 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 3f64de3d..f708826d 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 @@ -37,16 +37,15 @@ import at.gv.egiz.smcc.util.SMCCHelper; import at.gv.egiz.stal.QuitRequest; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; -import at.gv.egiz.stal.service.types.GetNextRequestResponseType; -import at.gv.egiz.stal.service.types.GetNextRequestType; -import at.gv.egiz.stal.service.types.ObjectFactory; import at.gv.egiz.stal.service.STALPortType; import at.gv.egiz.stal.service.STALService; import at.gv.egiz.stal.service.types.ErrorResponseType; +import at.gv.egiz.stal.service.types.GetNextRequestResponseType; +import at.gv.egiz.stal.service.types.GetNextRequestType; +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 java.applet.AppletContext; public class BKUWorker extends AbstractSMCCSTAL implements Runnable, ActionListener, SMCCSTALRequestHandler { @@ -74,7 +73,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, this.gui = gui; this.parent = parent; this.errorMessages = errorMessageBundle; - QuitHandler.getInstance().registerHandlerInstance(this); + addRequestHandler(QuitRequest.class, this); // register SignRequestHandler once we have a webservice port } @@ -87,7 +86,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, protected BKUWorker(BKUGUIFacade gui, ResourceBundle errorMessageBundle) { this.gui = gui; this.errorMessages = errorMessageBundle; - QuitHandler.getInstance().registerHandlerInstance(this); + addRequestHandler(QuitRequest.class, this); } private STALPortType getSTALPort() throws MalformedURLException { @@ -252,7 +251,6 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, if (signatureCard != null) { signatureCard.disconnect(false); } - QuitHandler.getInstance().unregisterHandlerInstance(this); sendRedirect(); } @@ -382,11 +380,6 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, public void init(SignatureCard sc, BKUGUIFacade gui) { } - @Override - public SMCCSTALRequestHandler newInstance() { - return this; - } - @Override public boolean requireCard() { return false; diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java index a9bbc559..2ac1bc62 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java @@ -5,15 +5,16 @@ package at.gv.egiz.bku.online.applet; -import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; -import at.gv.egiz.bku.smccstal.SignRequestHandler; -import at.gv.egiz.stal.signedinfo.ReferenceType; import java.applet.AppletContext; import java.net.URL; import java.util.List; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import at.gv.egiz.bku.smccstal.SignRequestHandler; +import at.gv.egiz.stal.signedinfo.ReferenceType; + /** * * @author clemens @@ -30,11 +31,6 @@ public class ExternalDisplaySignRequestHandler extends SignRequestHandler { this.hashDataURL = hashDataURL; } - @Override - public SMCCSTALRequestHandler newInstance() { - return new ExternalDisplaySignRequestHandler(ctx, hashDataURL); - } - @Override public void displayHashDataInputs(List signedReferences) throws Exception { //TODO pass reference Id's to servlet (TODO servlet) diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/MultiInstanceHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/MultiInstanceHandler.java deleted file mode 100644 index a07df559..00000000 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/MultiInstanceHandler.java +++ /dev/null @@ -1,49 +0,0 @@ -package at.gv.egiz.bku.online.applet; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.bku.gui.BKUGUIFacade; -import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; -import at.gv.egiz.smcc.SignatureCard; -import at.gv.egiz.stal.QuitRequest; -import at.gv.egiz.stal.STALRequest; -import at.gv.egiz.stal.STALResponse; - -public abstract class MultiInstanceHandler implements SMCCSTALRequestHandler { - - private static Log log = LogFactory.getLog(MultiInstanceHandler.class); - - protected List handlerList = new ArrayList(); - - - - protected MultiInstanceHandler() { - } - - public void registerHandlerInstance(SMCCSTALRequestHandler handler) { - handlerList.add(handler); - } - - public void unregisterHandlerInstance(SMCCSTALRequestHandler handler) { - handlerList.remove(handler); - } - - - @Override - public void init(SignatureCard sc, BKUGUIFacade gui) { - } - - @Override - public SMCCSTALRequestHandler newInstance() { - return this; - } - - @Override - public boolean requireCard() { - return false; - } -} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/QuitHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/QuitHandler.java deleted file mode 100644 index ab07e1a8..00000000 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/QuitHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -package at.gv.egiz.bku.online.applet; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; -import at.gv.egiz.stal.QuitRequest; -import at.gv.egiz.stal.STALRequest; -import at.gv.egiz.stal.STALResponse; - -public class QuitHandler extends MultiInstanceHandler { - - private static Log log = LogFactory.getLog(QuitHandler.class); - - private static QuitHandler instance = new QuitHandler(); - - private QuitHandler() { - } - - public static QuitHandler getInstance() { - return instance; - } - - @Override - public STALResponse handleRequest(STALRequest request) { - if (request instanceof QuitRequest) { - log.info("Received QuitCommand"); - for (SMCCSTALRequestHandler handler : handlerList) { - handler.handleRequest(request); - } - } else { - log.error("Unexpected request to handle: " + request); - } - return null; - } - -} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java index 4a87b8b5..b417fd33 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java @@ -16,24 +16,25 @@ */ package at.gv.egiz.bku.online.applet; -import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; -import at.gv.egiz.bku.smccstal.SignRequestHandler; -import at.gv.egiz.stal.HashDataInput; -import at.gv.egiz.stal.impl.ByteArrayHashDataInput; -import at.gv.egiz.stal.service.STALPortType; -import at.gv.egiz.stal.service.types.GetHashDataInputResponseType; -import at.gv.egiz.stal.service.types.GetHashDataInputType; -import at.gv.egiz.stal.signedinfo.DigestMethodType; -import at.gv.egiz.stal.signedinfo.ReferenceType; import java.security.DigestException; import java.security.MessageDigest; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import at.gv.egiz.bku.smccstal.SignRequestHandler; +import at.gv.egiz.stal.HashDataInput; +import at.gv.egiz.stal.impl.ByteArrayHashDataInput; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.types.GetHashDataInputResponseType; +import at.gv.egiz.stal.service.types.GetHashDataInputType; +import at.gv.egiz.stal.signedinfo.DigestMethodType; +import at.gv.egiz.stal.signedinfo.ReferenceType; + /** * @author clemens */ @@ -159,9 +160,4 @@ public class WebServiceSignRequestHandler extends SignRequestHandler { gui.showHashDataInputDialog(hashDataInputs, this, "ok"); } - - @Override - public SMCCSTALRequestHandler newInstance() { - return new WebServiceSignRequestHandler(this.sessId, this.stalPort); - } } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java index 4330f570..d5702e0e 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java @@ -113,11 +113,6 @@ public class LocalSignRequestHandler extends SignRequestHandler { gui.showHashDataInputDialog(selectedHashDataInputs, this, "ok"); } - @Override - public SMCCSTALRequestHandler newInstance() { - return new LocalSignRequestHandler(); - } - private ByteArrayHashDataInput getByteArrayHashDataInput(HashDataInput hashDataInput) throws IOException { InputStream hdIs = hashDataInput.getHashDataInput(); diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java index 4bc921aa..1bbb2e3c 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java @@ -27,7 +27,7 @@ public class SMCCSTAL extends BKUWorker { public List handleRequest(List requestList) { signatureCard = null; List responses = super.handleRequest(requestList); - //container.setVisible(false); + // container.setVisible(false); return responses; } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java index c5736648..e1d434e3 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java @@ -27,9 +27,6 @@ import javax.swing.WindowConstants; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIFactory; import at.gv.egiz.bku.online.applet.BKUApplet; -import at.gv.egiz.bku.online.applet.QuitHandler; -import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; -import at.gv.egiz.stal.QuitRequest; import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.STALFactory; @@ -39,7 +36,7 @@ public class SMCCSTALFactory implements STALFactory { @Override public STAL createSTAL() { - AbstractSMCCSTAL.addRequestHandler(QuitRequest.class, QuitHandler.getInstance()); + SMCCSTAL stal; JDialog dialog; ResourceBundle resourceBundle; diff --git a/BKULocalApp/src/main/java/at/gv/egiz/bku/local/app/BKULauncher.java b/BKULocalApp/src/main/java/at/gv/egiz/bku/local/app/BKULauncher.java index 54d595fa..23a893b4 100644 --- a/BKULocalApp/src/main/java/at/gv/egiz/bku/local/app/BKULauncher.java +++ b/BKULocalApp/src/main/java/at/gv/egiz/bku/local/app/BKULauncher.java @@ -181,9 +181,7 @@ public class BKULauncher implements BKUControllerInterface { * @param args */ public static void main(String[] args) { - try { - BKULauncher launcher = new BKULauncher(); launcher.initStart(); launcher.checkConfig(args); diff --git a/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java b/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java index 7f3a3b1c..77a3e2ea 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java @@ -267,7 +267,7 @@ public abstract class AbstractSignatureCard implements SignatureCard { if (card_ != null) { try { card_.disconnect(reset); - } catch (CardException e) { + } catch (Exception e) { log.info("Error while resetting card", e); } } diff --git a/smcc/src/main/java/at/gv/egiz/smcc/util/SMCCHelper.java b/smcc/src/main/java/at/gv/egiz/smcc/util/SMCCHelper.java index 3d1fd7c7..15971497 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/util/SMCCHelper.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/util/SMCCHelper.java @@ -49,11 +49,11 @@ public class SMCCHelper { update(); } - public void update() { + public synchronized void update() { update(-1); } - public void update(int sleep) { + public synchronized void update(int sleep) { SignatureCardFactory factory = SignatureCardFactory.getInstance(); if (useSWCard) { try { @@ -113,7 +113,7 @@ public class SMCCHelper { } } - public SignatureCard getSignatureCard(Locale locale) { + public synchronized SignatureCard getSignatureCard(Locale locale) { if (signatureCard != null) { signatureCard.setLocale(locale); } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java index b48388db..cf524737 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java @@ -37,19 +37,17 @@ import at.gv.egiz.stal.SignRequest; public abstract class AbstractSMCCSTAL implements STAL { private static Log log = LogFactory.getLog(AbstractSMCCSTAL.class); - + public final static int DEFAULT_MAX_RETRIES = 3; protected Locale locale = Locale.getDefault(); - // protected SMCCHelper smccHelper = new SMCCHelper(); protected SignatureCard signatureCard = null; - protected static Map handlerMap = new HashMap(); - + protected Map handlerMap = new HashMap(); + protected int maxRetries = DEFAULT_MAX_RETRIES; - static { + protected AbstractSMCCSTAL() { addRequestHandler(InfoboxReadRequest.class, new InfoBoxReadRequestHandler()); - // addRequestHandler(SignRequest.class, new SignRequestHandler()); } /** @@ -72,7 +70,7 @@ public abstract class AbstractSMCCSTAL implements STAL { log.info("Processing: " + request.getClass()); int retryCounter = 0; while (retryCounter < maxRetries) { - log.info("Number of retries: "+retryCounter); + log.info("Number of retries: " + retryCounter); SMCCSTALRequestHandler handler = null; handler = handlerMap.get(request.getClass().getSimpleName()); if (handler != null) { @@ -83,7 +81,6 @@ public abstract class AbstractSMCCSTAL implements STAL { } } try { - handler = handler.newInstance(); handler.init(signatureCard, getGUI()); STALResponse response = handler.handleRequest(request); if (response != null) { @@ -91,7 +88,7 @@ public abstract class AbstractSMCCSTAL implements STAL { log.info("Got an error response"); ErrorResponse err = (ErrorResponse) response; if (err.getErrorCode() == 6001) { - retryCounter = Integer.MAX_VALUE-1; + retryCounter = Integer.MAX_VALUE - 1; } if (++retryCounter < maxRetries) { log.info("Retrying"); @@ -128,13 +125,13 @@ public abstract class AbstractSMCCSTAL implements STAL { return responseList; } - public static void addRequestHandler(Class id, + public void addRequestHandler(Class id, SMCCSTALRequestHandler handler) { log.debug("Registering STAL request handler: " + id.getSimpleName()); handlerMap.put(id.getSimpleName(), handler); } - public static SMCCSTALRequestHandler getRequestHandler( + public SMCCSTALRequestHandler getRequestHandler( Class request) { return handlerMap.get(request.getSimpleName()); } @@ -150,5 +147,5 @@ public abstract class AbstractSMCCSTAL implements STAL { public void setMaxRetries(int maxRetries) { this.maxRetries = maxRetries; } - + } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java index 25085b16..b48d6d50 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java @@ -133,9 +133,4 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler implements } return new String(gui.getPin()); } - - @Override - public SMCCSTALRequestHandler newInstance() { - return new InfoBoxReadRequestHandler(); - } } diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SMCCSTALRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SMCCSTALRequestHandler.java index 6f303f76..94ab7a5b 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SMCCSTALRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SMCCSTALRequestHandler.java @@ -30,6 +30,4 @@ public interface SMCCSTALRequestHandler { public boolean requireCard(); - public SMCCSTALRequestHandler newInstance(); - } -- cgit v1.2.3 From 036dd1a8054c5dc818d01e238eb9480d67da478d Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 30 Oct 2008 17:43:40 +0000 Subject: Help Icon git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@130 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 158 +++++++++------- .../at/gv/egiz/bku/online/applet/BKUWorker.java | 24 +-- .../bku/online/applet/ExternalHelpListener.java | 70 ++++++++ BKUApplet/src/main/resources/simplelog.properties | 2 +- BKUApplet/src/test/resources/appletTest.html | 9 +- .../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 140 ++++++++++----- .../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 14 +- .../java/at/gv/egiz/bku/gui/HelpMouseListener.java | 33 ++++ .../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 200 +++++++++++++++------ .../at/gv/egiz/bku/gui/Messages.properties | 10 +- BKUCommonGUI/src/main/resources/images/help.png | Bin 0 -> 746 bytes BKUOnline/src/main/webapp/appletPage.jsp | 7 +- 12 files changed, 465 insertions(+), 202 deletions(-) create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java create mode 100644 BKUCommonGUI/src/main/resources/images/help.png (limited to 'BKUApplet') 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 97b5869f..470534da 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 @@ -21,6 +21,8 @@ import java.net.URL; import java.util.Locale; import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.net.ssl.HttpsURLConnection; import javax.swing.JApplet; @@ -36,79 +38,105 @@ import at.gv.egiz.bku.gui.BKUGUIFactory; */ 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"; - public static final String HASHDATA_DISPLAY = "HashDataDisplay"; - public final static String HASHDATA_URL = "HashDataURL"; - public final static String SESSION_ID = "SessionID"; - public static final String BACKGROUND_PARAM = "Background"; - 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; + 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"; + public static final String HASHDATA_DISPLAY = "HashDataDisplay"; + public final static String HASHDATA_URL = "HashDataURL"; + public final static String HELP_URL = "HelpURL"; + public final static String SESSION_ID = "SessionID"; + public static final String BACKGROUND_PARAM = "Background"; + 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; - public BKUApplet() { - } + public BKUApplet() { + } - public void init() { - log.info("Welcome to MOCCA\n"); - log.debug("Called init()"); - HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance()); - String localeString = getMyAppletParameter(LOCALE_PARAM_KEY); - if (localeString != null) { - resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE, + @Override + public void init() { + log.info("Welcome to MOCCA\n"); + log.debug("Called init()"); + HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance()); + String localeString = getMyAppletParameter(LOCALE_PARAM_KEY); + if (localeString != null) { + resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE, new Locale(localeString)); - } else { - resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE); - } - String backgroundString = getMyAppletParameter(BACKGROUND_PARAM); - URL background = null; - if (backgroundString != null) { - try { - background = new URL(backgroundString); - } catch (MalformedURLException ex) { - log.warn(ex.getMessage() + ", using default background"); - } - } - String guiStyle = getMyAppletParameter(GUI_STYLE); - BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle); - gui.init(getContentPane(), localeString, background); - worker = new BKUWorker(gui, this, resourceBundle); + } else { + resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE); } - - public void start() { - log.debug("Called start()"); - workerThread = new Thread(worker); - workerThread.start(); + String backgroundString = getMyAppletParameter(BACKGROUND_PARAM); + URL background = null; + if (backgroundString != null) { + try { + background = new URL(backgroundString); + } catch (MalformedURLException ex) { + log.warn(ex.getMessage() + ", using default background"); + } } - - public void stop() { - log.debug("Called stop()"); - if ((workerThread != null) && (workerThread.isAlive())) { - workerThread.interrupt(); - } + String guiStyle = getMyAppletParameter(GUI_STYLE); + BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle); + ExternalHelpListener helpListener = null; + try { + URL helpURL = getMyAppletParameterURL(HELP_URL); + helpListener = new ExternalHelpListener(getAppletContext(), helpURL, localeString); + } catch (MalformedURLException ex) { + log.error("invalid help URL: " + ex.getMessage()); } + gui.init(getContentPane(), localeString, background, helpListener); + worker = new BKUWorker(gui, this, resourceBundle); + } - public void destroy() { - log.debug("Called destroy()"); + @Override + public void start() { + log.debug("Called start()"); + workerThread = new Thread(worker); + workerThread.start(); + } + + @Override + public void stop() { + log.debug("Called stop()"); + if ((workerThread != null) && (workerThread.isAlive())) { + workerThread.interrupt(); } + } + + @Override + public void destroy() { + log.debug("Called destroy()"); + } + + /** + * Applet configuration parameters + * + * @param paramKey + * @return + */ + String getMyAppletParameter(String paramKey) { + log.info("Getting parameter: " + paramKey + ": " + getParameter(paramKey)); + return getParameter(paramKey); + } - /** - * Applet configuration parameters - * - * @param paramKey - * @return - */ - public String getMyAppletParameter(String paramKey) { - log.info("Getting parameter: " + paramKey + ": " + getParameter(paramKey)); - return getParameter(paramKey); + URL getMyAppletParameterURL(String param) throws MalformedURLException { + String hashDataParam = getMyAppletParameter(param); //BKUApplet.HASHDATA_URL); + if (hashDataParam != null) { + URL codebase = getCodeBase(); + try { + return new URL(codebase, hashDataParam); + } catch (MalformedURLException ex) { + log.error("Paremeter " + param + " is not a valid URL.", ex); + throw new MalformedURLException(ex.getMessage()); + } + } else { + log.error("Paremeter " + param + " not set"); + throw new MalformedURLException(param + " not set"); } + } } 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 f708826d..78f3dc12 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 @@ -24,6 +24,8 @@ import java.util.ArrayList; import java.util.List; import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.xml.namespace.QName; import org.apache.commons.logging.Log; @@ -46,6 +48,7 @@ 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 { @@ -68,7 +71,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, public BKUWorker(BKUGUIFacade gui, BKUApplet parent, ResourceBundle errorMessageBundle) { if ((gui == null) || (parent == null) || (errorMessageBundle == null)) { - throw new NullPointerException("Parameter must not be set to null"); + throw new NullPointerException("Parameter must not be set to null"); } this.gui = gui; this.parent = parent; @@ -117,23 +120,6 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, return stal.getSTALPort(); } - private URL getHashDataURL() throws MalformedURLException { - String hashDataParam = parent.getMyAppletParameter(BKUApplet.HASHDATA_URL); - URL codebase = parent.getCodeBase(); - if (hashDataParam != null) { - try { - return new URL(codebase, hashDataParam); -// log.debug("Found HashDataInputServlet URL: " + hashDataURL); - } catch (MalformedURLException ex) { - log.fatal("Paremeter " + BKUApplet.HASHDATA_URL + " is not a vailid URL.", ex); - throw new MalformedURLException(ex.getMessage()); - } - } else { - log.fatal("Paremeter " + BKUApplet.HASHDATA_URL + " not set"); - throw new MalformedURLException(BKUApplet.HASHDATA_URL + " not set"); - } - } - @Override public void run() { gui.showWelcomeDialog(); @@ -165,7 +151,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable, log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL); addRequestHandler(at.gv.egiz.stal.SignRequest.class, new WebServiceSignRequestHandler(sessionId, stalPort)); } else { //if (HASHDATADISPLAY_EXTERNAL.equals(displayStyle)) { - URL hashDataURL = getHashDataURL(); + URL hashDataURL = parent.getMyAppletParameterURL(BKUApplet.HASHDATA_URL); log.debug("register SignRequestHandler for HashDataURL " + hashDataURL); addRequestHandler(at.gv.egiz.stal.SignRequest.class, new ExternalDisplaySignRequestHandler(parent.getAppletContext(), hashDataURL)); } diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java new file mode 100644 index 00000000..4d6d5851 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java @@ -0,0 +1,70 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package at.gv.egiz.bku.online.applet; + +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 clemens + */ +public class ExternalHelpListener implements ActionListener { + + protected final static Log log = LogFactory.getLog(ExternalHelpListener.class); + protected AppletContext ctx; + protected String helpURLBase; + protected String locale; + + public ExternalHelpListener(AppletContext ctx, URL helpURL, String locale) { + if (ctx == null) { + throw new RuntimeException("no applet context provided"); + } + if (helpURL == null || "".equals(helpURL)) { + throw new RuntimeException("no help URL provided"); + } + this.ctx = ctx; + this.helpURLBase = helpURL.toString(); + this.locale = locale; + } + + @Override + public void actionPerformed(ActionEvent e) { + log.debug("received help action: " + e.getActionCommand()); + URL helpURL; + try { + String urlString = helpURLBase; + if (locale != null) { + urlString = appendParameter(urlString, "locale", locale); + } + if (e.getActionCommand() != null && !"".equals(e.getActionCommand())) { + urlString = appendParameter(urlString, "topic", e.getActionCommand()); + } + helpURL = new URL(urlString); + } catch (MalformedURLException ex) { + try { + log.error("failed to create help URL: " + ex.getMessage()); + helpURL = new URL(helpURLBase); + } catch (MalformedURLException ex1) { + log.error("failed to create default help URL, requested help will not be displayed"); + return; + } + } + ctx.showDocument(helpURL, "_blank"); + } + + private String appendParameter(String url, String paramName, String paramValue) { + if (url.indexOf('?') < 0) { + return url + "?" + paramName + "=" + paramValue; + } else { + return url + "&" + paramName + "=" + paramValue; + } + } +} diff --git a/BKUApplet/src/main/resources/simplelog.properties b/BKUApplet/src/main/resources/simplelog.properties index 51be76a8..d62508cf 100644 --- a/BKUApplet/src/main/resources/simplelog.properties +++ b/BKUApplet/src/main/resources/simplelog.properties @@ -15,7 +15,7 @@ # Logging detail level, # Must be one of ("trace", "debug", "info", "warn", "error", or "fatal"). -org.apache.commons.logging.simplelog.defaultlog=trace +org.apache.commons.logging.simplelog.defaultlog=debug # Logs the Log instance used org.apache.commons.logging.simplelog.showlogname=true #Logs the class name with package(or Path) diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html index 472000de..daf8445b 100644 --- a/BKUApplet/src/test/resources/appletTest.html +++ b/BKUApplet/src/test/resources/appletTest.html @@ -19,14 +19,15 @@
- + width=300 height=200> + - + + - +
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java index 7e0f0447..27841d1c 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java @@ -41,6 +41,7 @@ import java.util.List; import java.util.Locale; import java.util.ResourceBundle; import javax.swing.GroupLayout; +import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFileChooser; @@ -66,6 +67,8 @@ public class BKUGUI implements BKUGUIFacade { private static final Log log = LogFactory.getLog(BKUGUI.class); + protected HelpMouseListener helpListener; + protected Container contentPane; protected ResourceBundle messages; /** left and right side main panels */ @@ -89,7 +92,7 @@ public class BKUGUI implements BKUGUIFacade { * @param localeString may be null */ @Override - public void init(final Container contentPane, String localeString, final URL background) { + public void init(final Container contentPane, String localeString, final URL background, ActionListener helpListener) { if (localeString != null) { messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString)); @@ -98,6 +101,7 @@ public class BKUGUI implements BKUGUIFacade { } this.contentPane = contentPane; + registerHelpListener(helpListener); try { @@ -175,6 +179,11 @@ public class BKUGUI implements BKUGUIFacade { titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() | java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2)); + JLabel helpLabel = new JLabel(); + helpLabel.setIcon(new ImageIcon(getClass().getResource(HELP_IMG))); + helpLabel.addMouseListener(helpListener); + helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + JButton b = new JButton(); b.setText(messages.getString(BUTTON_CANCEL)); if (b.getPreferredSize().width > buttonSize) @@ -204,15 +213,17 @@ public class BKUGUI implements BKUGUIFacade { GroupLayout headerPanelLayout = new GroupLayout(headerPanel); headerPanel.setLayout(headerPanelLayout); -// + headerPanelLayout.setHorizontalGroup( headerPanelLayout.createSequentialGroup() - .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) - .addContainerGap()); + .addComponent(titleLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel)); headerPanelLayout.setVerticalGroup( - headerPanelLayout.createSequentialGroup() - .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); - + headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) //SequentialGroup() + .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) + .addComponent(helpLabel)); + GroupLayout contentPanelLayout = new GroupLayout(contentPanel); contentPanel.setLayout(contentPanelLayout); @@ -234,7 +245,7 @@ public class BKUGUI implements BKUGUIFacade { .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) //, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addContainerGap()); //); + .addContainerGap()); } @Override @@ -291,6 +302,8 @@ public class BKUGUI implements BKUGUIFacade { titleLabel.setText(messages.getString(TITLE_WELCOME)); + helpListener.setHelpTopic(HELP_WELCOME); + JLabel welcomeMsgLabel = new JLabel(); welcomeMsgLabel.setFont(welcomeMsgLabel.getFont().deriveFont(welcomeMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); welcomeMsgLabel.setText(messages.getString(MESSAGE_WAIT)); @@ -300,10 +313,10 @@ public class BKUGUI implements BKUGUIFacade { mainPanelLayout.setHorizontalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(welcomeMsgLabel)); + .addComponent(welcomeMsgLabel)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(welcomeMsgLabel)); + .addComponent(welcomeMsgLabel)); contentPanel.validate(); @@ -328,6 +341,8 @@ public class BKUGUI implements BKUGUIFacade { titleLabel.setText(messages.getString(TITLE_INSERTCARD)); + helpListener.setHelpTopic(HELP_INSERTCARD); + JLabel insertCardMsgLabel = new JLabel(); insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); insertCardMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD)); @@ -385,6 +400,8 @@ public class BKUGUI implements BKUGUIFacade { titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED)); + helpListener.setHelpTopic(HELP_CARDNOTSUPPORTED); + JLabel insertCardMsgLabel = new JLabel(); insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); insertCardMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD)); @@ -476,10 +493,12 @@ public class BKUGUI implements BKUGUIFacade { infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); String infoPattern = messages.getString(MESSAGE_ENTERPIN); infoLabel.setText(MessageFormat.format(infoPattern, new Object[] {pinSpec.getLocalizedName()})); + helpListener.setHelpTopic(HELP_CARDPIN); } else { infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD)); infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); infoLabel.setForeground(ERROR_COLOR); + helpListener.setHelpTopic(HELP_RETRY); } JLabel pinsizeLabel = new JLabel(); @@ -496,7 +515,7 @@ public class BKUGUI implements BKUGUIFacade { mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addGroup(mainPanelLayout.createSequentialGroup() .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) @@ -506,13 +525,13 @@ public class BKUGUI implements BKUGUIFacade { mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(infoLabel) - .addGap(infoLabel.getFont().getSize()) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(cardPinLabel) - .addComponent(pinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinsizeLabel)); + .addComponent(infoLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(cardPinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel)); GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); @@ -628,10 +647,12 @@ public class BKUGUI implements BKUGUIFacade { hashdataListener.actionPerformed(e); } }); + helpListener.setHelpTopic(HELP_SIGNPIN); } else { infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD)); infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); infoLabel.setForeground(ERROR_COLOR); + helpListener.setHelpTopic(HELP_RETRY); } GroupLayout mainPanelLayout = new GroupLayout(mainPanel); @@ -640,22 +661,22 @@ public class BKUGUI implements BKUGUIFacade { mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pinsizeLabel)))); + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pinsizeLabel)))); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() .addComponent(infoLabel) - .addGap(infoLabel.getFont().getSize()) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(signPinLabel) - .addComponent(pinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinsizeLabel)); + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(signPinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel)); GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); @@ -695,6 +716,8 @@ public class BKUGUI implements BKUGUIFacade { titleLabel.setText(messages.getString(TITLE_ERROR)); + helpListener.setHelpTopic(errorMsgKey); + String errorMsgPattern = messages.getString(errorMsgKey); String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams); @@ -708,10 +731,10 @@ public class BKUGUI implements BKUGUIFacade { mainPanelLayout.setHorizontalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(errorMsgLabel)); + .addComponent(errorMsgLabel)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(errorMsgLabel)); + .addComponent(errorMsgLabel)); JButton okButton = new JButton(); okButton.setText(messages.getString(BUTTON_OK)); @@ -751,6 +774,8 @@ public class BKUGUI implements BKUGUIFacade { titleLabel.setText(messages.getString(TITLE_ERROR)); + helpListener.setHelpTopic(errorMsgKey); + String errorMsgPattern = messages.getString(errorMsgKey); String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams); @@ -764,10 +789,10 @@ public class BKUGUI implements BKUGUIFacade { mainPanelLayout.setHorizontalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(errorMsgLabel)); + .addComponent(errorMsgLabel)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(errorMsgLabel)); + .addComponent(errorMsgLabel)); contentPanel.validate(); } @@ -791,6 +816,8 @@ public class BKUGUI implements BKUGUIFacade { // titleLabel.setText(messages.getString(TITLE_WAIT)); + helpListener.setHelpTopic(HELP_WAIT); + JLabel waitMsgLabel = new JLabel(); waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); if (waitMessage != null) { @@ -804,10 +831,10 @@ public class BKUGUI implements BKUGUIFacade { mainPanelLayout.setHorizontalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(waitMsgLabel)); + .addComponent(waitMsgLabel)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(waitMsgLabel)); + .addComponent(waitMsgLabel)); contentPanel.validate(); } @@ -883,6 +910,8 @@ public class BKUGUI implements BKUGUIFacade { titleLabel.setText(messages.getString(TITLE_HASHDATA)); + helpListener.setHelpTopic(HELP_HASHDATA); + JLabel refIdLabel = new JLabel(); refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); refIdLabel.setText(messages.getString(MESSAGE_HASHDATA)); //MessageFormat.format(refIdLabelPattern, new Object[]{refId})); @@ -904,14 +933,14 @@ public class BKUGUI implements BKUGUIFacade { mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(refIdLabel) - .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); + .addComponent(refIdLabel) + .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(refIdLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); + .addComponent(refIdLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); JButton backButton = new JButton(); backButton.setText(messages.getString(BUTTON_BACK)); @@ -958,6 +987,8 @@ public class BKUGUI implements BKUGUIFacade { titleLabel.setText(messages.getString(TITLE_HASHDATA)); + helpListener.setHelpTopic(HELP_HASHDATALIST); + JLabel refIdLabel = new JLabel(); refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); String refIdLabelPattern = messages.getString(MESSAGE_HASHDATALIST); @@ -982,15 +1013,15 @@ public class BKUGUI implements BKUGUIFacade { mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(refIdLabel) - .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); + .addComponent(refIdLabel) + .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(refIdLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(hashDataScrollPane, 0, 0, hashDataTable.getPreferredSize().height+3)); - + .addComponent(refIdLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(hashDataScrollPane, 0, 0, hashDataTable.getPreferredSize().height+3)); + JButton backButton = new JButton(); backButton.setText(messages.getString(BUTTON_BACK)); backButton.setActionCommand(cancelCommand); @@ -1133,4 +1164,19 @@ public class BKUGUI implements BKUGUIFacade { } } } + + private void registerHelpListener(ActionListener helpListener) { + if (helpListener != null) { + this.helpListener = new HelpMouseListener(helpListener); + } else { + log.error("no help listener provided, will not be able to display help"); + this.helpListener = new HelpMouseListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + log.error("no help listener registered (requested help topic: " + e.getActionCommand() + ")"); + } + }); + } + } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index ced74834..6c157e76 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -37,6 +37,7 @@ public interface BKUGUIFacade { public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages"; public static final String DEFAULT_BACKGROUND = "/images/BackgroundChipperling.png"; + public static final String HELP_IMG = "/images/help.png"; public static final String HASHDATA_FONT = "Monospaced"; public static final Color ERROR_COLOR = Color.RED; public static final Color HYPERLINK_COLOR = Color.BLUE; @@ -63,6 +64,15 @@ public interface BKUGUIFacade { public static final String LABEL_PIN = "label.pin"; public static final String LABEL_PINSIZE = "label.pinsize"; // public static final String ERROR_NO_HASHDATA = "error.no.hashdata"; + public static final String HELP_WELCOME = "help.welcome"; + public static final String HELP_WAIT = "help.wait"; + public static final String HELP_CARDNOTSUPPORTED = "help.cardnotsupported"; + public static final String HELP_INSERTCARD = "help.insertcard"; + public static final String HELP_CARDPIN = "help.cardpin"; + public static final String HELP_SIGNPIN = "help.signpin"; + public static final String HELP_RETRY = "help.retry"; + public static final String HELP_HASHDATA = "help.hashdata"; + public static final String HELP_HASHDATALIST = "help.hashdatalist"; public static final String BUTTON_OK = "button.ok"; public static final String BUTTON_CANCEL = "button.cancel"; @@ -72,9 +82,9 @@ public interface BKUGUIFacade { public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix"; - public void init(Container contentPane, String localeString, URL background); + public void init(Container contentPane, String localeString, URL background, ActionListener helpListener); - public void showWelcomeDialog(); + public void showWelcomeDialog(); /** * MOA-ID only diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java new file mode 100644 index 00000000..6d814f01 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java @@ -0,0 +1,33 @@ +package at.gv.egiz.bku.gui; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class HelpMouseListener extends MouseAdapter { + + protected static final Log log = LogFactory.getLog(HelpMouseListener.class); + + protected ActionListener externalHelpListener; + protected String locale; + protected String topic; + + public HelpMouseListener(ActionListener externalHelpListener) { + super(); + this.externalHelpListener = externalHelpListener; + } + + public void setHelpTopic(String topic) { + log.trace("setting help topic: " + topic); + this.topic = topic; + } + + @Override + public void mouseClicked(MouseEvent arg0) { + ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, topic); + externalHelpListener.actionPerformed(e); + } +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java index c37704e2..29913d2a 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java @@ -41,6 +41,7 @@ import java.util.List; import java.util.Locale; import java.util.ResourceBundle; import javax.swing.GroupLayout; +import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JFileChooser; @@ -65,6 +66,8 @@ import org.apache.commons.logging.LogFactory; public class SimpleGUI implements BKUGUIFacade { private static final Log log = LogFactory.getLog(SimpleGUI.class); + + protected HelpMouseListener helpListener; protected Container contentPane; protected ResourceBundle messages; @@ -77,6 +80,7 @@ public class SimpleGUI implements BKUGUIFacade { protected JPanel buttonPanel; /** right side fixed labels */ // protected JLabel titleLabel; + protected JLabel helpLabel; /** remember the pinfield to return to worker */ protected JPasswordField pinField; @@ -89,7 +93,7 @@ public class SimpleGUI implements BKUGUIFacade { * @param localeString may be null */ @Override - public void init(final Container contentPane, String localeString, final URL background) { + public void init(final Container contentPane, String localeString, final URL background, ActionListener helpListener) { if (localeString != null) { messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString)); @@ -98,7 +102,8 @@ public class SimpleGUI implements BKUGUIFacade { } this.contentPane = contentPane; - + registerHelpListener(helpListener); + try { log.debug("scheduling gui initialization"); @@ -131,7 +136,7 @@ public class SimpleGUI implements BKUGUIFacade { throw new RuntimeException("Failed to init GUI: " + ex.getMessage()); } } - + // protected void initIconPanel() { // iconPanel = new JPanel(); // JLabel iconLabel = new JLabel(); @@ -151,7 +156,7 @@ public class SimpleGUI implements BKUGUIFacade { // .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //); // } - protected void initContentPanel(URL background) { + protected void initContentPanel(URL background) { if (background == null) { background = this.getClass().getResource(DEFAULT_BACKGROUND); @@ -175,6 +180,11 @@ public class SimpleGUI implements BKUGUIFacade { // titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() | // java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2)); + helpLabel = new JLabel(); + helpLabel.setIcon(new ImageIcon(getClass().getResource(HELP_IMG))); + helpLabel.addMouseListener(helpListener); + helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + JButton b = new JButton(); // b.setText(messages.getString(BUTTON_CANCEL)); // if (b.getPreferredSize().width > buttonSize) @@ -207,8 +217,7 @@ public class SimpleGUI implements BKUGUIFacade { // // headerPanelLayout.setHorizontalGroup( // headerPanelLayout.createSequentialGroup() -// .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) -// .addContainerGap()); +// .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); // headerPanelLayout.setVerticalGroup( // headerPanelLayout.createSequentialGroup() // .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); @@ -234,7 +243,7 @@ public class SimpleGUI implements BKUGUIFacade { .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) //, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addContainerGap()); //); + .addContainerGap()); } @Override @@ -291,6 +300,8 @@ public class SimpleGUI implements BKUGUIFacade { // titleLabel.setText(messages.getString(TITLE_WELCOME)); + helpListener.setHelpTopic(HELP_WELCOME); + JLabel welcomeMsgLabel = new JLabel(); welcomeMsgLabel.setFont(welcomeMsgLabel.getFont().deriveFont(welcomeMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); welcomeMsgLabel.setText(messages.getString(TITLE_WELCOME)); @@ -299,12 +310,16 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() - .addComponent(welcomeMsgLabel)); + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(mainPanelLayout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel)) + .addComponent(welcomeMsgLabel)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(welcomeMsgLabel)); - + .addComponent(helpLabel) + .addComponent(welcomeMsgLabel)); + contentPanel.validate(); } @@ -328,6 +343,8 @@ public class SimpleGUI implements BKUGUIFacade { // titleLabel.setText(messages.getString(TITLE_INSERTCARD)); + helpListener.setHelpTopic(HELP_INSERTCARD); + JLabel insertCardMsgLabel = new JLabel(); insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); insertCardMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD)); @@ -336,10 +353,14 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(mainPanelLayout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel)) .addComponent(insertCardMsgLabel)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() + .addComponent(helpLabel) .addComponent(insertCardMsgLabel)); // JButton cancelButton = new JButton(); @@ -385,6 +406,8 @@ public class SimpleGUI implements BKUGUIFacade { // titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED)); + helpListener.setHelpTopic(HELP_CARDNOTSUPPORTED); + JLabel insertCardMsgLabel = new JLabel(); insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); insertCardMsgLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED)); @@ -393,12 +416,16 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(mainPanelLayout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel)) .addComponent(insertCardMsgLabel)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() + .addComponent(helpLabel) .addComponent(insertCardMsgLabel)); - + // JButton cancelButton = new JButton(); // cancelButton.setText(messages.getString(BUTTON_CANCEL)); // cancelButton.addActionListener(cancelListener); @@ -477,10 +504,12 @@ public class SimpleGUI implements BKUGUIFacade { infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); String infoPattern = messages.getString(MESSAGE_ENTERPIN); infoLabel.setText(MessageFormat.format(infoPattern, new Object[] {pinSpec.getLocalizedName()})); + helpListener.setHelpTopic(HELP_CARDPIN); } else { infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD)); infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); infoLabel.setForeground(ERROR_COLOR); + helpListener.setHelpTopic(HELP_RETRY); } JLabel pinsizeLabel = new JLabel(); @@ -497,7 +526,10 @@ public class SimpleGUI implements BKUGUIFacade { mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup(mainPanelLayout.createSequentialGroup() .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) @@ -507,13 +539,15 @@ public class SimpleGUI implements BKUGUIFacade { mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(infoLabel) - .addGap(infoLabel.getFont().getSize()) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(cardPinLabel) - .addComponent(pinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinsizeLabel)); + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(infoLabel) + .addComponent(helpLabel)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(cardPinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel)); GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); @@ -580,7 +614,7 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.removeAll(); buttonPanel.removeAll(); - + // if (numRetries < 0) { // titleLabel.setText(messages.getString(TITLE_SIGN)); // } else { @@ -626,7 +660,7 @@ public class SimpleGUI implements BKUGUIFacade { pinSize += "-" + pinSpec.getMaxLength(); } pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); - + JLabel infoLabel = new JLabel(); if (numRetries < 0) { infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); @@ -641,10 +675,12 @@ public class SimpleGUI implements BKUGUIFacade { hashdataListener.actionPerformed(e); } }); + helpListener.setHelpTopic(HELP_SIGNPIN); } else { infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD)); infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); infoLabel.setForeground(ERROR_COLOR); + helpListener.setHelpTopic(HELP_RETRY); } GroupLayout mainPanelLayout = new GroupLayout(mainPanel); @@ -652,23 +688,28 @@ public class SimpleGUI implements BKUGUIFacade { mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(mainPanelLayout.createSequentialGroup() .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pinsizeLabel)))); + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pinsizeLabel)))); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(infoLabel) - .addGap(infoLabel.getFont().getSize()) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(signPinLabel) - .addComponent(pinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinsizeLabel)); + .addComponent(helpLabel)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(signPinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel)); GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); @@ -719,6 +760,8 @@ public class SimpleGUI implements BKUGUIFacade { // titleLabel.setText(messages.getString(TITLE_ERROR)); + helpListener.setHelpTopic(errorMsgKey); + String errorMsgPattern = messages.getString(errorMsgKey); String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams); @@ -731,12 +774,16 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() - .addComponent(errorMsgLabel)); + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(mainPanelLayout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel)) + .addComponent(errorMsgLabel)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(errorMsgLabel)); - + .addComponent(helpLabel) + .addComponent(errorMsgLabel)); + JButton okButton = new JButton(); okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD)); okButton.setText(messages.getString(BUTTON_OK)); @@ -776,6 +823,8 @@ public class SimpleGUI implements BKUGUIFacade { // titleLabel.setText(messages.getString(TITLE_ERROR)); + helpListener.setHelpTopic(errorMsgKey); + String errorMsgPattern = messages.getString(errorMsgKey); String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams); @@ -788,11 +837,15 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() - .addComponent(errorMsgLabel)); + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(mainPanelLayout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel)) + .addComponent(errorMsgLabel)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(errorMsgLabel)); + .addComponent(helpLabel) + .addComponent(errorMsgLabel)); contentPanel.validate(); } @@ -816,6 +869,8 @@ public class SimpleGUI implements BKUGUIFacade { // titleLabel.setText(messages.getString(TITLE_WAIT)); + helpListener.setHelpTopic(HELP_WAIT); + JLabel waitMsgLabel = new JLabel(); waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); if (waitMessage != null) { @@ -828,11 +883,15 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.setLayout(mainPanelLayout); mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() - .addComponent(waitMsgLabel)); + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(mainPanelLayout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel)) + .addComponent(waitMsgLabel)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(waitMsgLabel)); + .addComponent(helpLabel) + .addComponent(waitMsgLabel)); contentPanel.validate(); } @@ -907,6 +966,8 @@ public class SimpleGUI implements BKUGUIFacade { buttonPanel.removeAll(); // titleLabel.setText(messages.getString(TITLE_HASHDATA)); + + helpListener.setHelpTopic(HELP_HASHDATA); JLabel refIdLabel = new JLabel(); refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); @@ -929,14 +990,19 @@ public class SimpleGUI implements BKUGUIFacade { mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(refIdLabel) - .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(refIdLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel)) + .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(refIdLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(refIdLabel) + .addComponent(helpLabel)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); JButton backButton = new JButton(); backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD)); @@ -995,6 +1061,8 @@ public class SimpleGUI implements BKUGUIFacade { // titleLabel.setText(messages.getString(TITLE_HASHDATA)); + helpListener.setHelpTopic(HELP_HASHDATALIST); + JLabel refIdLabel = new JLabel(); refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); String refIdLabelPattern = messages.getString(MESSAGE_HASHDATALIST); @@ -1019,14 +1087,19 @@ public class SimpleGUI implements BKUGUIFacade { mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(refIdLabel) - .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(refIdLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel)) + .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addComponent(refIdLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(hashDataScrollPane, 0, 0, hashDataTable.getPreferredSize().height+3)); + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(refIdLabel) + .addComponent(helpLabel)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(hashDataScrollPane, 0, 0, hashDataTable.getPreferredSize().height+3)); JButton backButton = new JButton(); backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD)); @@ -1183,4 +1256,19 @@ public class SimpleGUI implements BKUGUIFacade { } } } + + private void registerHelpListener(ActionListener helpListener) { + if (helpListener != null) { + this.helpListener = new HelpMouseListener(helpListener); + } else { + log.error("no help listener provided, will not be able to display help"); + this.helpListener = new HelpMouseListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + log.error("no help listener registered (requested help topic: " + e.getActionCommand() + ")"); + } + }); + } + } } diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index a38e2cf8..5a427360 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -26,12 +26,12 @@ windowtitle.save=Signaturdaten speichern windowtitle.savedir=Signaturdaten in Verzeichnis speichern windowtitle.overwrite=Datei \u00FCberschreiben? message.wait=Bitte warten... -message.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken -message.enterpin=Bitte {0} eingeben -message.hashdatalink=Signaturdaten anzeigen... -message.hashdata=Ein Signaturdatenobjekt: +message.insertcard=Bitte die B\u00FCrgerkarte in den Kartenleser stecken +message.enterpin={0} eingeben +message.hashdatalink=Signaturdaten anzeigen +message.hashdata=Signaturdaten: #message.hashdata=Referenz Id: {0} -message.hashdatalist={0} Signaturdatenobjekte: +message.hashdatalist={0} Signaturdaten: message.retries=Noch {0} Versuch(e) message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben? label.pin={0}: diff --git a/BKUCommonGUI/src/main/resources/images/help.png b/BKUCommonGUI/src/main/resources/images/help.png new file mode 100644 index 00000000..4ed65a97 Binary files /dev/null and b/BKUCommonGUI/src/main/resources/images/help.png differ diff --git a/BKUOnline/src/main/webapp/appletPage.jsp b/BKUOnline/src/main/webapp/appletPage.jsp index ffb67828..8ddbed13 100644 --- a/BKUOnline/src/main/webapp/appletPage.jsp +++ b/BKUOnline/src/main/webapp/appletPage.jsp @@ -52,9 +52,10 @@ var parameters = { GuiStyle : '<%=guiStyle%>', Background : '<%=backgroundImg%>', - WSDL_URL : '../stal?wsdl', - HashDataDisplay : '<%=hashDataDisplay%>', - HashDataURL : '../hashDataInput', + WSDL_URL :'../stal?wsdl', + HelpURL : '../help', + HashDataDisplay : 'external', + HashDataURL : '../hashDataInput', SessionID : '<%=session.getId()%>', RedirectURL : '../bkuResult' }; -- cgit v1.2.3 From 8479ef50c84e8998f7909074df6a23c2ff0aa5b0 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 31 Oct 2008 12:33:18 +0000 Subject: Help Icon git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@132 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/nb-configuration.xml | 6 ++++++ .../applet/ExternalDisplaySignRequestHandler.java | 16 ++++++++++++++-- .../gv/egiz/bku/online/applet/ExternalHelpListener.java | 17 +++++++++++++++-- .../bku/online/applet/InternalSSLSocketFactory.java | 4 ---- .../bku/online/applet/WebServiceSignRequestHandler.java | 1 + .../src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 1 + .../src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java | 1 + .../java/at/gv/egiz/bku/gui/HashDataTableModel.java | 1 + .../main/java/at/gv/egiz/bku/gui/HelpMouseListener.java | 17 +++++++++++++++++ .../src/main/java/at/gv/egiz/bku/gui/ImagePanel.java | 16 ++++++++++++++-- .../src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 5 +---- .../src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 2 +- .../java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java | 4 ++-- .../java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 2 +- 14 files changed, 75 insertions(+), 18 deletions(-) create mode 100644 BKUApplet/nb-configuration.xml (limited to 'BKUApplet') diff --git a/BKUApplet/nb-configuration.xml b/BKUApplet/nb-configuration.xml new file mode 100644 index 00000000..352a03be --- /dev/null +++ b/BKUApplet/nb-configuration.xml @@ -0,0 +1,6 @@ + + + + bka + + diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java index 2ac1bc62..2c9fde71 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java @@ -1,6 +1,18 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package at.gv.egiz.bku.online.applet; diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java index 4d6d5851..f92a6963 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java @@ -1,7 +1,20 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ + package at.gv.egiz.bku.online.applet; import java.applet.AppletContext; diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java index fa3587e4..c3417d63 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java @@ -14,10 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ package at.gv.egiz.bku.online.applet; diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java index b417fd33..ddbe76bf 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package at.gv.egiz.bku.online.applet; import java.security.DigestException; diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index 6c157e76..872f1874 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package at.gv.egiz.bku.gui; import at.gv.egiz.stal.HashDataInput; diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java index 4a338f23..87676026 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package at.gv.egiz.bku.gui; public class BKUGUIFactory { diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java index 1a833f48..aea85523 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java @@ -14,6 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package at.gv.egiz.bku.gui; import at.gv.egiz.stal.HashDataInput; diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java index 6d814f01..531884d1 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java @@ -1,3 +1,20 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package at.gv.egiz.bku.gui; import java.awt.event.ActionEvent; diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java index e9c270ce..1185cf53 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java @@ -1,6 +1,18 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package at.gv.egiz.bku.gui; diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java index 29913d2a..195db27a 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java @@ -14,10 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ + package at.gv.egiz.bku.gui; import at.gv.egiz.smcc.PINSpec; 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 308be642..c32a237a 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 @@ -40,7 +40,7 @@ public class BKUGUITest { BKUGUI gui = new BKUGUI(); Container contentPane = testFrame.getContentPane(); contentPane.setPreferredSize(new Dimension(380, 150)); - gui.init(contentPane, null, null); + gui.init(contentPane, null, null, null); BKUGUIWorker worker = new BKUGUIWorker(); worker.init(gui); testFrame.pack(); diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java index d12be9ac..8a850549 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java @@ -37,8 +37,8 @@ public class BKUGuiProxy implements BKUGUIFacade { } @Override - public void init(Container contentPane, String localeString, URL bgImage) { - delegate.init(contentPane, localeString, bgImage); + public void init(Container contentPane, String localeString, URL bgImage, ActionListener helpListener) { + delegate.init(contentPane, localeString, bgImage, helpListener); } @Override diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java index e1d434e3..df5c2b28 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java @@ -48,7 +48,7 @@ public class SMCCSTALFactory implements STALFactory { } dialog = new JDialog(); BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI); - gui.init(dialog.getContentPane(), locale.toString(), null); + gui.init(dialog.getContentPane(), locale.toString(), null, null); stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog, resourceBundle); dialog.setPreferredSize(new Dimension(400, 200)); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); -- cgit v1.2.3 From 9be429abebb90f3e4e97c215a354acedc4e0f49d Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 31 Oct 2008 12:42:49 +0000 Subject: License git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@134 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/nb-configuration.xml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 BKUApplet/nb-configuration.xml (limited to 'BKUApplet') diff --git a/BKUApplet/nb-configuration.xml b/BKUApplet/nb-configuration.xml deleted file mode 100644 index 352a03be..00000000 --- a/BKUApplet/nb-configuration.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - bka - - -- cgit v1.2.3 From 4032e46810c24dc3f013de296a2133f4651696b9 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 31 Oct 2008 15:30:34 +0000 Subject: local HelpListener card locked/not activated git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@137 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../egiz/bku/online/applet/AppletHelpListener.java | 46 ++++++++ .../at/gv/egiz/bku/online/applet/BKUApplet.java | 4 +- .../bku/online/applet/ExternalHelpListener.java | 83 -------------- .../at/gv/egiz/bku/gui/AbstractHelpListener.java | 84 +++++++++++++++ .../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 2 + .../at/gv/egiz/bku/gui/Messages.properties | 4 +- BKULocal/pom.xml | 119 ++++++++++----------- .../gv/egiz/bku/local/gui/LocalHelpListener.java | 41 +++++++ .../at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 11 +- BKUOnline/src/main/webapp/HTTP-ohne.html | 2 +- .../bku/smccstal/InfoBoxReadRequestHandler.java | 7 ++ .../gv/egiz/bku/smccstal/SignRequestHandler.java | 6 ++ 12 files changed, 260 insertions(+), 149 deletions(-) create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java create mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java (limited to 'BKUApplet') diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java new file mode 100644 index 00000000..a0305eb4 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java @@ -0,0 +1,46 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.online.applet; + +import at.gv.egiz.bku.gui.AbstractHelpListener; +import java.applet.AppletContext; +import java.net.URL; + +/** + * + * @author clemens + */ +public class AppletHelpListener extends AbstractHelpListener { + + protected AppletContext ctx; + + public AppletHelpListener(AppletContext ctx, URL helpURL, String locale) { + super(helpURL, locale); + if (ctx == null) { + throw new RuntimeException("no applet context provided"); + } + this.ctx = ctx; + } + + @Override + public void showDocument(URL helpDocument) throws Exception { + ctx.showDocument(helpDocument, "_blank"); + } + + +} 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 470534da..2b0188bb 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 @@ -82,10 +82,10 @@ public class BKUApplet extends JApplet { } String guiStyle = getMyAppletParameter(GUI_STYLE); BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle); - ExternalHelpListener helpListener = null; + AppletHelpListener helpListener = null; try { URL helpURL = getMyAppletParameterURL(HELP_URL); - helpListener = new ExternalHelpListener(getAppletContext(), helpURL, localeString); + helpListener = new AppletHelpListener(getAppletContext(), helpURL, localeString); } catch (MalformedURLException ex) { log.error("invalid help URL: " + ex.getMessage()); } diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java deleted file mode 100644 index f92a6963..00000000 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package at.gv.egiz.bku.online.applet; - -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 clemens - */ -public class ExternalHelpListener implements ActionListener { - - protected final static Log log = LogFactory.getLog(ExternalHelpListener.class); - protected AppletContext ctx; - protected String helpURLBase; - protected String locale; - - public ExternalHelpListener(AppletContext ctx, URL helpURL, String locale) { - if (ctx == null) { - throw new RuntimeException("no applet context provided"); - } - if (helpURL == null || "".equals(helpURL)) { - throw new RuntimeException("no help URL provided"); - } - this.ctx = ctx; - this.helpURLBase = helpURL.toString(); - this.locale = locale; - } - - @Override - public void actionPerformed(ActionEvent e) { - log.debug("received help action: " + e.getActionCommand()); - URL helpURL; - try { - String urlString = helpURLBase; - if (locale != null) { - urlString = appendParameter(urlString, "locale", locale); - } - if (e.getActionCommand() != null && !"".equals(e.getActionCommand())) { - urlString = appendParameter(urlString, "topic", e.getActionCommand()); - } - helpURL = new URL(urlString); - } catch (MalformedURLException ex) { - try { - log.error("failed to create help URL: " + ex.getMessage()); - helpURL = new URL(helpURLBase); - } catch (MalformedURLException ex1) { - log.error("failed to create default help URL, requested help will not be displayed"); - return; - } - } - ctx.showDocument(helpURL, "_blank"); - } - - private String appendParameter(String url, String paramName, String paramValue) { - if (url.indexOf('?') < 0) { - return url + "?" + paramName + "=" + paramValue; - } else { - return url + "&" + paramName + "=" + paramValue; - } - } -} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java new file mode 100644 index 00000000..68d61bef --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java @@ -0,0 +1,84 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.gui; + +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 Clemens Orthacker + */ +public abstract class AbstractHelpListener implements ActionListener { + + protected final static Log log = LogFactory.getLog(AbstractHelpListener.class); + protected String helpURLBase; + protected String locale; + + public AbstractHelpListener(URL baseURL, String locale) { + if (baseURL == null || "".equals(baseURL)) { + throw new RuntimeException("no help URL provided"); + } + this.helpURLBase = baseURL.toString(); + this.locale = locale; + } + + @Override + public void actionPerformed(ActionEvent e) { + log.debug("received help action: " + e.getActionCommand()); + URL helpURL; + try { + String urlString = helpURLBase; + if (locale != null) { + urlString = appendParameter(urlString, "locale", locale); + } + if (e.getActionCommand() != null && !"".equals(e.getActionCommand())) { + urlString = appendParameter(urlString, "topic", e.getActionCommand()); + } + helpURL = new URL(urlString); + } catch (MalformedURLException ex) { + try { + log.error("failed to create help URL: " + ex.getMessage()); + helpURL = new URL(helpURLBase); + } catch (MalformedURLException ex1) { + log.error("failed to create default help URL, requested help will not be displayed"); + return; + } + } + try { + showDocument(helpURL); + } catch (Exception ex) { + log.error("could not display help document " + helpURL + ": " + ex.getMessage()); + } + } + + private String appendParameter(String url, String paramName, String paramValue) { + if (url.indexOf('?') < 0) { + return url + "?" + paramName + "=" + paramValue; + } else { + return url + "&" + paramName + "=" + paramValue; + } + } + + public abstract void showDocument(URL helpDocument) throws Exception; + +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index 872f1874..4ef1b7d9 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -35,6 +35,8 @@ public interface BKUGUIFacade { public static final String ERR_DISPLAY_HASHDATA = "error.display.hashdata"; public static final String ERR_WRITE_HASHDATA = "error.write.hashdata"; public static final String ERR_INVALID_HASH = "error.invalid.hash"; + public static final String ERR_CARD_LOCKED = "error.card.locked"; + public static final String ERR_CARD_NOTACTIVATED = "error.card.notactivated"; public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages"; public static final String DEFAULT_BACKGROUND = "/images/BackgroundChipperling.png"; diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index 5a427360..1f51de77 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -58,4 +58,6 @@ error.ws.unreachable=Das Web-Service ist nicht erreichbar: {0} error.pcsc=Java(TM) scheint keine PC/SC Schnittstelle f\u00FCr den Smartcard-Zugriff zur Verf\u00FCgung zu stellen. error.cardterminal=Es konnte kein Smartcard-Leser gefunden werden.

Entweder ist kein Leser angeschlossen oder kein PC/SC Treiber installiert.

error.unknown=Leider trat ein Fehler auf: {0} -error.test=Fehler1 {0} - Fehler2 {1} \ No newline at end of file +error.test=Fehler1 {0} - Fehler2 {1} +error.card.locked=B\u00FCrgerkarte ist gesperrt +error.card.notactivated=B\u00FCrgerkartenfunktion ist nicht aktiviert \ No newline at end of file diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index 204fa6b9..03a6a10b 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -1,25 +1,22 @@ - - - bku - at.gv.egiz - 1.0-SNAPSHOT - - 4.0.0 - at.gv.egiz - BKULocal - war - BKU Local - 1.0-SNAPSHOT - + + + bku + at.gv.egiz + 1.0-SNAPSHOT + + 4.0.0 + at.gv.egiz + BKULocal + war + BKU Local + 1.0-SNAPSHOT scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal - + @@ -27,15 +24,11 @@ 2.0.2 - - true - + true - - ${project.version}-r${buildNumber} - + ${project.version}-r${buildNumber} @@ -59,47 +52,47 @@ - - - - at.gv.egiz - STAL - 1.0-SNAPSHOT - - - at.gv.egiz - bkucommon - 1.0-SNAPSHOT - - - at.gv.egiz - smcc - 1.0-SNAPSHOT + + + + at.gv.egiz + STAL + 1.0-SNAPSHOT + + + at.gv.egiz + bkucommon + 1.0-SNAPSHOT + + + at.gv.egiz + smcc + 1.0-SNAPSHOT at.gv.egiz smccSTAL 1.0-SNAPSHOT - - - org.springframework - spring-core - 2.5.5 - - - javax.servlet - servlet-api - 2.5 - provided - - - org.springframework - spring-web - 2.5.5 - - - commons-logging - commons-logging + + + org.springframework + spring-core + 2.5.5 + + + javax.servlet + servlet-api + 2.5 + provided + + + org.springframework + spring-web + 2.5.5 + + + commons-logging + commons-logging at.gv.egiz @@ -110,6 +103,10 @@ at.gv.egiz BKUViewer 1.0-SNAPSHOT - - - \ No newline at end of file + +
+ + + Tomcat60 + + diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java new file mode 100644 index 00000000..ebec9c65 --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java @@ -0,0 +1,41 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.local.gui; + +import at.gv.egiz.bku.gui.AbstractHelpListener; +import java.awt.Desktop; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; + +/** + * + * @author Clemens Orthacker + */ +public class LocalHelpListener extends AbstractHelpListener { + + public LocalHelpListener(URL baseURL, String locale) { + super(baseURL, locale); + } + + @Override + public void showDocument(URL helpDocument) throws IOException, URISyntaxException { + Desktop.getDesktop().browse(helpDocument.toURI()); + } + +} diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java index df5c2b28..d3530332 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java @@ -18,6 +18,7 @@ package at.gv.egiz.bku.local.stal; import java.awt.Dimension; import java.awt.Toolkit; +import java.net.MalformedURLException; import java.util.Locale; import java.util.ResourceBundle; @@ -26,9 +27,11 @@ import javax.swing.WindowConstants; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIFactory; +import at.gv.egiz.bku.local.gui.LocalHelpListener; import at.gv.egiz.bku.online.applet.BKUApplet; import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.STALFactory; +import java.net.URL; public class SMCCSTALFactory implements STALFactory { @@ -48,7 +51,13 @@ public class SMCCSTALFactory implements STALFactory { } dialog = new JDialog(); BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI); - gui.init(dialog.getContentPane(), locale.toString(), null, null); + LocalHelpListener helpListener =null; + try { + helpListener = new LocalHelpListener(new URL("http://localhost:3495/help"), "en"); + } catch (MalformedURLException ex) { + ex.printStackTrace(); + } + gui.init(dialog.getContentPane(), locale.toString(), null, helpListener); stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog, resourceBundle); dialog.setPreferredSize(new Dimension(400, 200)); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); diff --git a/BKUOnline/src/main/webapp/HTTP-ohne.html b/BKUOnline/src/main/webapp/HTTP-ohne.html index 044432ce..47c059f2 100644 --- a/BKUOnline/src/main/webapp/HTTP-ohne.html +++ b/BKUOnline/src/main/webapp/HTTP-ohne.html @@ -98,7 +98,7 @@ legend { advanced

- + external internal

diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java index cfac8cf5..cfc5c4bd 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java @@ -16,6 +16,7 @@ */ package at.gv.egiz.bku.smccstal; +import at.gv.egiz.bku.gui.BKUGUIFacade; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -104,9 +105,15 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler implements } } catch (NotActivatedException e) { log.info("Citizen card not activated.", e); + gui.showErrorDialog(BKUGUIFacade.ERR_CARD_NOTACTIVATED, null, this, null); + waitForAction(); + gui.showWaitDialog(null); return new ErrorResponse(6001); } catch (LockedException e) { log.info("Citizen card locked.", e); + gui.showErrorDialog(BKUGUIFacade.ERR_CARD_LOCKED, null, this, null); + waitForAction(); + gui.showWaitDialog(null); return new ErrorResponse(6001); } catch (CancelledException cx) { log.debug("User cancelled request", cx); diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java index 466ec2a9..dbc70bff 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java @@ -94,9 +94,15 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen return stalResp; } catch (NotActivatedException e) { log.info("Citizen card not activated.", e); + gui.showErrorDialog(BKUGUIFacade.ERR_CARD_NOTACTIVATED, null, this, null); + waitForAction(); + gui.showWaitDialog(null); return new ErrorResponse(6001); } catch (LockedException e) { log.info("Citizen card locked.", e); + gui.showErrorDialog(BKUGUIFacade.ERR_CARD_LOCKED, null, this, null); + waitForAction(); + gui.showWaitDialog(null); return new ErrorResponse(6001); } catch (CancelledException cx) { log.debug("User cancelled request"); -- cgit v1.2.3 From 9829de9c9b19dcca15676aaf9737195cc059a66c Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 3 Nov 2008 09:37:14 +0000 Subject: local HelpListener DesktopAPI git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@138 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../egiz/bku/online/applet/AppletHelpListener.java | 3 +- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 6 ++-- .../at/gv/egiz/bku/gui/AbstractHelpListener.java | 7 +++-- .../gv/egiz/bku/local/gui/LocalHelpListener.java | 20 +++++++++--- .../at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 30 +++++++++++++----- .../egiz/bku/local/webapp/BKURequestHandler.java | 5 +-- .../src/main/webapp/WEB-INF/applicationContext.xml | 36 ++++++++++++---------- 7 files changed, 69 insertions(+), 38 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java index a0305eb4..4040431f 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java @@ -20,6 +20,7 @@ package at.gv.egiz.bku.online.applet; import at.gv.egiz.bku.gui.AbstractHelpListener; import java.applet.AppletContext; import java.net.URL; +import java.util.Locale; /** * @@ -29,7 +30,7 @@ public class AppletHelpListener extends AbstractHelpListener { protected AppletContext ctx; - public AppletHelpListener(AppletContext ctx, URL helpURL, String locale) { + public AppletHelpListener(AppletContext ctx, URL helpURL, Locale locale) { super(helpURL, locale); if (ctx == null) { throw new RuntimeException("no applet context provided"); 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 2b0188bb..50d66d80 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 @@ -65,9 +65,11 @@ public class BKUApplet extends JApplet { 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, - new Locale(localeString)); + locale); } else { resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE); } @@ -85,7 +87,7 @@ public class BKUApplet extends JApplet { AppletHelpListener helpListener = null; try { URL helpURL = getMyAppletParameterURL(HELP_URL); - helpListener = new AppletHelpListener(getAppletContext(), helpURL, localeString); + helpListener = new AppletHelpListener(getAppletContext(), helpURL, locale); } catch (MalformedURLException ex) { log.error("invalid help URL: " + ex.getMessage()); } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java index 68d61bef..6e3167c1 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java @@ -21,6 +21,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.net.MalformedURLException; import java.net.URL; +import java.util.Locale; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -32,9 +33,9 @@ public abstract class AbstractHelpListener implements ActionListener { protected final static Log log = LogFactory.getLog(AbstractHelpListener.class); protected String helpURLBase; - protected String locale; + protected Locale locale; - public AbstractHelpListener(URL baseURL, String locale) { + public AbstractHelpListener(URL baseURL, Locale locale) { if (baseURL == null || "".equals(baseURL)) { throw new RuntimeException("no help URL provided"); } @@ -49,7 +50,7 @@ public abstract class AbstractHelpListener implements ActionListener { try { String urlString = helpURLBase; if (locale != null) { - urlString = appendParameter(urlString, "locale", locale); + urlString = appendParameter(urlString, "locale", locale.toString()); } if (e.getActionCommand() != null && !"".equals(e.getActionCommand())) { urlString = appendParameter(urlString, "topic", e.getActionCommand()); diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java index ebec9c65..e32c9c3d 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package at.gv.egiz.bku.local.gui; import at.gv.egiz.bku.gui.AbstractHelpListener; @@ -22,6 +21,7 @@ import java.awt.Desktop; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; +import java.util.Locale; /** * @@ -29,13 +29,25 @@ import java.net.URL; */ public class LocalHelpListener extends AbstractHelpListener { - public LocalHelpListener(URL baseURL, String locale) { + protected Desktop desktop; + + public LocalHelpListener(URL baseURL, Locale locale) { super(baseURL, locale); + if (Desktop.isDesktopSupported()) { + desktop = Desktop.getDesktop(); + } } @Override public void showDocument(URL helpDocument) throws IOException, URISyntaxException { - Desktop.getDesktop().browse(helpDocument.toURI()); + if (desktop == null) { + log.error("Failed to open default browser: Desktop API not available (libgnome installed?)"); + } else { + if (!desktop.isSupported(Desktop.Action.BROWSE)) { + log.error("Failed to open default browser: The system provides the Desktop API, but does not support the BROWSE action"); + } else { + Desktop.getDesktop().browse(helpDocument.toURI()); + } + } } - } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java index d3530332..4cc7bcd3 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java @@ -32,30 +32,38 @@ import at.gv.egiz.bku.online.applet.BKUApplet; import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.STALFactory; import java.net.URL; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; public class SMCCSTALFactory implements STALFactory { - private Locale locale; + protected static final Log log = LogFactory.getLog(SMCCSTALFactory.class); + protected String helpURL; + protected Locale locale; @Override public STAL createSTAL() { - + SMCCSTAL stal; JDialog dialog; ResourceBundle resourceBundle; if (locale != null) { resourceBundle = ResourceBundle.getBundle(BKUApplet.RESOURCE_BUNDLE_BASE, - locale); + locale); } else { resourceBundle = ResourceBundle.getBundle(BKUApplet.RESOURCE_BUNDLE_BASE); } dialog = new JDialog(); BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI); - LocalHelpListener helpListener =null; + LocalHelpListener helpListener = null; try { - helpListener = new LocalHelpListener(new URL("http://localhost:3495/help"), "en"); + if (helpURL != null) { + helpListener = new LocalHelpListener(new URL(helpURL), locale); + } else { + log.warn("no HELP URL configured, help system disabled"); + } } catch (MalformedURLException ex) { - ex.printStackTrace(); + log.error("failed to configure help listener: " + ex.getMessage(), ex); } gui.init(dialog.getContentPane(), locale.toString(), null, helpListener); stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog, resourceBundle); @@ -72,7 +80,7 @@ public class SMCCSTALFactory implements STALFactory { frameSize.width = screenSize.width; } dialog.setLocation((screenSize.width - frameSize.width) / 2, - (screenSize.height - frameSize.height) / 2); + (screenSize.height - frameSize.height) / 2); return stal; } @@ -80,4 +88,12 @@ public class SMCCSTALFactory implements STALFactory { public void setLocale(Locale locale) { this.locale = locale; } + + public String getHelpURL() { + return helpURL; + } + + public void setHelpURL(String helpURL) { + this.helpURL = helpURL; + } } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java index f19b86b5..62705d1e 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java @@ -16,7 +16,6 @@ */ package at.gv.egiz.bku.local.webapp; -import java.io.IOException; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; @@ -30,12 +29,10 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.web.HttpRequestHandler; import at.gv.egiz.bku.binding.BindingProcessorManager; import at.gv.egiz.bku.binding.HTTPBindingProcessor; import at.gv.egiz.bku.binding.HttpUtil; -import at.gv.egiz.bku.utils.StreamUtil; import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage; public abstract class BKURequestHandler extends HttpServlet { @@ -68,7 +65,7 @@ public abstract class BKURequestHandler extends HttpServlet { bindingProcessor.setHTTPHeaders(headerMap); bindingProcessor.consumeRequestStream(req.getInputStream()); - // fixxme just for testing + // fixxme just for testing bindingProcessor.run(); if (bindingProcessor.getRedirectURL() != null) { resp.sendRedirect(bindingProcessor.getRedirectURL()); diff --git a/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml b/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml index a951f056..3191f82f 100644 --- a/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml +++ b/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml @@ -1,25 +1,27 @@ - + + scope="singleton"> + + 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 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 20 ++--- .../at/gv/egiz/bku/online/applet/BKUWorker.java | 17 ++-- .../at/gv/egiz/bku/online/applet/images/logo.png | Bin 4035 -> 0 bytes .../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 11 ++- .../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 9 ++- .../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 11 ++- .../at/gv/egiz/bku/gui/Messages.properties | 86 ++++++++++----------- .../at/gv/egiz/bku/gui/Messages_de.properties | 62 +++++++++++++++ .../at/gv/egiz/bku/local/stal/BKUGuiProxy.java | 10 ++- .../java/at/gv/egiz/bku/local/stal/SMCCSTAL.java | 6 +- .../at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 16 ++-- 11 files changed, 156 insertions(+), 92 deletions(-) delete mode 100644 BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png create mode 100644 BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties (limited to 'BKUApplet') 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); diff --git a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png deleted file mode 100644 index eee4be4f..00000000 Binary files a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png and /dev/null differ diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java index 27841d1c..9f733a14 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java @@ -92,10 +92,10 @@ public class BKUGUI implements BKUGUIFacade { * @param localeString may be null */ @Override - public void init(final Container contentPane, String localeString, final URL background, ActionListener helpListener) { + public void init(final Container contentPane, Locale locale, final URL background, ActionListener helpListener) { - if (localeString != null) { - messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString)); + if (locale != null) { + messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, locale); } else { messages = ResourceBundle.getBundle(MESSAGES_BUNDLE); } @@ -248,6 +248,11 @@ public class BKUGUI implements BKUGUIFacade { .addContainerGap()); } + @Override + public Locale getLocale() { + return messages.getLocale(); + } + @Override public void showLoginDialog(ActionListener loginListener, String actionCommand) { diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index 4ef1b7d9..6655cf64 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -24,6 +24,7 @@ import java.awt.Container; import java.awt.event.ActionListener; import java.net.URL; import java.util.List; +import java.util.Locale; public interface BKUGUIFacade { @@ -85,7 +86,13 @@ public interface BKUGUIFacade { public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix"; - public void init(Container contentPane, String localeString, URL background, ActionListener helpListener); + public void init(Container contentPane, Locale locale, URL background, ActionListener helpListener); + + /** + * + * @return the locale of the message bundle (what if no message bundle could be loaded for the requested locale?) + */ + public Locale getLocale(); public void showWelcomeDialog(); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java index 195db27a..a005292e 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java @@ -90,10 +90,10 @@ public class SimpleGUI implements BKUGUIFacade { * @param localeString may be null */ @Override - public void init(final Container contentPane, String localeString, final URL background, ActionListener helpListener) { + public void init(final Container contentPane, Locale locale, final URL background, ActionListener helpListener) { - if (localeString != null) { - messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString)); + if (locale != null) { + messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, locale); } else { messages = ResourceBundle.getBundle(MESSAGES_BUNDLE); } @@ -243,6 +243,11 @@ public class SimpleGUI implements BKUGUIFacade { .addContainerGap()); } + @Override + public Locale getLocale() { + return messages.getLocale(); + } + @Override public void showLoginDialog(ActionListener loginListener, String actionCommand) { diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index 1f51de77..2e6b7b14 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -13,51 +13,49 @@ # See the License for the specific language governing permissions and # limitations under the License. -title.welcome=Willkommen -title.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken -title.cardnotsupported=Die Karte wird nicht unterst\u00FCtzt -title.cardpin={0} eingeben -title.sign=Signatur erstellen -title.error=Ein Fehler trat auf -title.retry=Falscher PIN -title.wait=Bitte warten -title.hashdata=Signaturdaten -windowtitle.save=Signaturdaten speichern -windowtitle.savedir=Signaturdaten in Verzeichnis speichern -windowtitle.overwrite=Datei \u00FCberschreiben? -message.wait=Bitte warten... -message.insertcard=Bitte die B\u00FCrgerkarte in den Kartenleser stecken -message.enterpin={0} eingeben -message.hashdatalink=Signaturdaten anzeigen -message.hashdata=Signaturdaten: -#message.hashdata=Referenz Id: {0} -message.hashdatalist={0} Signaturdaten: -message.retries=Noch {0} Versuch(e) -message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben? +title.welcome=Welcome +title.insertcard=Please insert your citizen-card into the reader +title.cardnotsupported=This card is not supported +title.cardpin=Enter {0} +title.sign=Create signature +title.error=Error +title.retry=Wrong PIN +title.wait=Please wait +title.hashdata=Signature data +windowtitle.save=Save signature data +windowtitle.savedir=Save signature data to directory +windowtitle.overwrite=Overwrite file? +message.wait=Please wait... +message.insertcard=Please insert your citizen-card into the reader +message.enterpin=Enter {0} +message.hashdatalink=Display signature data +message.hashdata=Signature data: +message.hashdatalist={0} signature data objects: +message.retries={0} tries left +message.overwrite=Overwrite {0}? label.pin={0}: -label.pinsize=({0} stellig) +label.pinsize=({0} digits) button.ok=OK -button.cancel=Abbrechen -button.back=Zur\u00FCck -button.sign=Signieren -button.save=Speichern... -mimetype.desc.xml=XML-Dateien (.xml) -mimetype.desc.html=HTML-Dateien (.html, .htm) -mimetype.desc.xhtml=XHTML-Dateien (.xhtml) -mimetype.desc.txt=Textdateien (.txt) -mimetype.desc.pdf=Adobe PDF-Dateien (.pdf) -mimetype.desc.bin=Bin\u00E4rdateien (.bin) -save.hashdatainput.prefix=Signaturdaten +button.cancel=Cancel +button.back=Back +button.sign=Sign +button.save=Save... +mimetype.desc.xml=XML-files (.xml) +mimetype.desc.html=HTML-files (.html, .htm) +mimetype.desc.xhtml=XHTML-files (.xhtml) +mimetype.desc.txt=Textfiles (.txt) +mimetype.desc.pdf=Adobe PDF-files (.pdf) +mimetype.desc.bin=Binary files (.bin) +save.hashdatainput.prefix=signaturedata # Error Messages -error.no.hashdata=Keine Signaturdaten verf\u00FCgbar: {0} -error.display.hashdata=Signaturdaten konnten nicht dargestellt werden: {0} -error.write.hashdata=Die Signaturdaten konnten nicht gespeichert werden: {0} -error.invalid.hash=Die Signaturdaten sind ung\u00FCltig: {0} -error.ws.unreachable=Das Web-Service ist nicht erreichbar: {0} -error.pcsc=Java(TM) scheint keine PC/SC Schnittstelle f\u00FCr den Smartcard-Zugriff zur Verf\u00FCgung zu stellen. -error.cardterminal=Es konnte kein Smartcard-Leser gefunden werden.

Entweder ist kein Leser angeschlossen oder kein PC/SC Treiber installiert.

-error.unknown=Leider trat ein Fehler auf: {0} -error.test=Fehler1 {0} - Fehler2 {1} -error.card.locked=B\u00FCrgerkarte ist gesperrt -error.card.notactivated=B\u00FCrgerkartenfunktion ist nicht aktiviert \ No newline at end of file +error.no.hashdata=No signature data available: {0} +error.display.hashdata=Could not display signature data: {0} +error.write.hashdata=Could not save signature data: {0} +error.invalid.hash=Invalid signature data: {0} +error.ws.unreachable=Web-service unreachable: {0} +error.pcsc=No PC/SC interface for smartcard access provided +error.cardterminal=Could not find smartcard reader +error.unknown=An error occured: {0} +error.card.locked=Citizen-card is locked +error.card.notactivated=Citizen-card not activated \ No newline at end of file diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties new file mode 100644 index 00000000..af0cb016 --- /dev/null +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties @@ -0,0 +1,62 @@ +# Copyright 2008 Federal Chancellery Austria and +# Graz University of Technology +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +title.welcome=Willkommen +title.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken +title.cardnotsupported=Die Karte wird nicht unterst\u00FCtzt +title.cardpin={0} eingeben +title.sign=Signatur erstellen +title.error=Fehler +title.retry=Falscher PIN +title.wait=Bitte warten +title.hashdata=Signaturdaten +windowtitle.save=Signaturdaten speichern +windowtitle.savedir=Signaturdaten in Verzeichnis speichern +windowtitle.overwrite=Datei \u00FCberschreiben? +message.wait=Bitte warten... +message.insertcard=Bitte die B\u00FCrgerkarte in den Kartenleser stecken +message.enterpin={0} eingeben +message.hashdatalink=Signaturdaten anzeigen +message.hashdata=Signaturdaten: +message.hashdatalist={0} Signaturdaten: +message.retries=Noch {0} Versuch(e) +message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben? +label.pin={0}: +label.pinsize=({0} stellig) +button.ok=OK +button.cancel=Abbrechen +button.back=Zur\u00FCck +button.sign=Signieren +button.save=Speichern... +mimetype.desc.xml=XML-Dateien (.xml) +mimetype.desc.html=HTML-Dateien (.html, .htm) +mimetype.desc.xhtml=XHTML-Dateien (.xhtml) +mimetype.desc.txt=Textdateien (.txt) +mimetype.desc.pdf=Adobe PDF-Dateien (.pdf) +mimetype.desc.bin=Bin\u00E4rdateien (.bin) +save.hashdatainput.prefix=Signaturdaten + +# Error Messages +error.no.hashdata=Keine Signaturdaten verf\u00FCgbar: {0} +error.display.hashdata=Signaturdaten konnten nicht dargestellt werden: {0} +error.write.hashdata=Die Signaturdaten konnten nicht gespeichert werden: {0} +error.invalid.hash=Die Signaturdaten sind ung\u00FCltig: {0} +error.ws.unreachable=Das Web-Service ist nicht erreichbar: {0} +error.pcsc=Java(TM) scheint keine PC/SC Schnittstelle f\u00FCr den Smartcard-Zugriff zur Verf\u00FCgung zu stellen. +error.cardterminal=Es konnte kein Smartcard-Leser gefunden werden.

Entweder ist kein Leser angeschlossen oder kein PC/SC Treiber installiert.

+error.unknown=Leider trat ein Fehler auf: {0} +error.test=Fehler1 {0} - Fehler2 {1} +error.card.locked=B\u00FCrgerkarte ist gesperrt +error.card.notactivated=B\u00FCrgerkartenfunktion ist nicht aktiviert \ No newline at end of file diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java index 8a850549..44cae8a0 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java @@ -10,6 +10,7 @@ import java.awt.event.WindowEvent; import java.net.URL; import java.util.List; +import java.util.Locale; import javax.swing.JDialog; import at.gv.egiz.bku.gui.BKUGUIFacade; @@ -37,8 +38,13 @@ public class BKUGuiProxy implements BKUGUIFacade { } @Override - public void init(Container contentPane, String localeString, URL bgImage, ActionListener helpListener) { - delegate.init(contentPane, localeString, bgImage, helpListener); + public void init(Container contentPane, Locale locale, URL bgImage, ActionListener helpListener) { + delegate.init(contentPane, locale, bgImage, helpListener); + } + + @Override + public Locale getLocale() { + return delegate.getLocale(); } @Override diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java index 1bbb2e3c..6bf37c40 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java @@ -1,7 +1,6 @@ package at.gv.egiz.bku.local.stal; import java.util.List; -import java.util.ResourceBundle; import javax.swing.JDialog; @@ -16,9 +15,8 @@ public class SMCCSTAL extends BKUWorker { private JDialog container; - public SMCCSTAL(BKUGUIFacade gui, JDialog container, - ResourceBundle errorMessageBundle) { - super(gui, errorMessageBundle); + public SMCCSTAL(BKUGUIFacade gui, JDialog container) { + super(gui); this.container = container; addRequestHandler(SignRequest.class, new LocalSignRequestHandler()); } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java index 4cc7bcd3..ad7b9646 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java @@ -28,7 +28,6 @@ import javax.swing.WindowConstants; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIFactory; import at.gv.egiz.bku.local.gui.LocalHelpListener; -import at.gv.egiz.bku.online.applet.BKUApplet; import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.STALFactory; import java.net.URL; @@ -45,28 +44,23 @@ public class SMCCSTALFactory implements STALFactory { public STAL createSTAL() { SMCCSTAL stal; - JDialog dialog; - ResourceBundle resourceBundle; + JDialog dialog = new JDialog(); if (locale != null) { - resourceBundle = ResourceBundle.getBundle(BKUApplet.RESOURCE_BUNDLE_BASE, - locale); - } else { - resourceBundle = ResourceBundle.getBundle(BKUApplet.RESOURCE_BUNDLE_BASE); + dialog.setLocale(locale); } - dialog = new JDialog(); BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI); LocalHelpListener helpListener = null; try { if (helpURL != null) { - helpListener = new LocalHelpListener(new URL(helpURL), locale); + helpListener = new LocalHelpListener(new URL(helpURL), dialog.getLocale()); } else { log.warn("no HELP URL configured, help system disabled"); } } catch (MalformedURLException ex) { log.error("failed to configure help listener: " + ex.getMessage(), ex); } - gui.init(dialog.getContentPane(), locale.toString(), null, helpListener); - stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog, resourceBundle); + gui.init(dialog.getContentPane(), dialog.getLocale(), null, helpListener); + stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog); dialog.setPreferredSize(new Dimension(400, 200)); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); dialog.setTitle("MOCCA"); -- cgit v1.2.3 From 4d27cbd65e358f9ae778b6911e8de527e86f6bda Mon Sep 17 00:00:00 2001 From: mcentner Date: Mon, 3 Nov 2008 14:31:47 +0000 Subject: Localization default language set to German (de). git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@141 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../gv/egiz/bku/online/applet/Messages.properties | 58 ------------- .../egiz/bku/online/applet/Messages_de.properties | 42 --------- .../at/gv/egiz/bku/gui/Messages.properties | 85 ++++++++++--------- .../at/gv/egiz/bku/gui/Messages_de.properties | 62 -------------- .../at/gv/egiz/bku/gui/Messages_en.properties | 62 ++++++++++++++ .../slexceptions/SLExceptionMessages_de.properties | 99 ---------------------- .../main/java/at/gv/egiz/smcc/util/SMCCHelper.java | 4 +- .../resources/at/gv/egiz/smcc/ACOSCard.properties | 2 +- .../at/gv/egiz/smcc/ACOSCard_de.properties | 21 ----- .../at/gv/egiz/smcc/ACOSCard_en.properties | 21 ----- .../at/gv/egiz/smcc/STARCOSCard.properties | 4 +- .../at/gv/egiz/smcc/STARCOSCard_de.properties | 20 ----- .../at/gv/egiz/smcc/STARCOSCard_en.properties | 20 ----- 13 files changed, 110 insertions(+), 390 deletions(-) delete mode 100644 BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties delete mode 100644 BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties delete mode 100644 BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties create mode 100644 BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties delete mode 100644 bkucommon/src/main/resources/at/gv/egiz/bku/slexceptions/SLExceptionMessages_de.properties delete mode 100644 smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard_de.properties delete mode 100644 smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard_en.properties delete mode 100644 smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard_de.properties delete mode 100644 smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard_en.properties (limited to 'BKUApplet') diff --git a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties deleted file mode 100644 index 752004e8..00000000 --- a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages.properties +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright 2008 Federal Chancellery Austria and -# Graz University of Technology -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# -------- BEGIN bootstrap applet -----------# -java16required=This Applet requires Java 1.6 or higher to run. \ - Please download and install a recent version of Java. \ -

For Windows, Linux and Solaris plattforms you can download Java from \ - http://java.sun.com/javase/downloads.\ -

- -failedtostart=Failed to start Applet. \ -

{0}

-# -------- END bootstrap applet -----------# - - -applet.name=Online Citicen Card Environment (CCE) - -nopcscsupport=The Java plattform does not seem to provide \ -a PC/SC interface to acces a smartcard. - -nocardterminal=Can not find a connected smartcard reader.\ -

Either there is no smartcard reader connected, or \ - no PC/SC driver is installed for a connected smartcard reader.

- -insertcard=Please insert your citicen card (B\u00FCrgerkarte) into your \ - smartcard reader. - -unsupportedcard=The inserted smartcard is not supported.\ -

Please insert your citicen card (B\u00FCrgerkarte) \ - into your smartcard reader.

- -enterpin=Please enter {0} \(min {1}, max {2} digits\). - -enterpinretries=Please enter {0} \(min {1}, max {2} digits, {3} retries left\). - -pinwrong=Entered PIN is wrong. - -button.ok=Ok - -button.cancel=Cancel - -status.findpcsc=Looking for PC/SC support - -status.findsupportedcard=Looking for a supported smartcard - -failed.WS=Webservice cannot be reached. \ No newline at end of file diff --git a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties deleted file mode 100644 index e6b815e9..00000000 --- a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/Messages_de.properties +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright 2008 Federal Chancellery Austria and -# Graz University of Technology -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# -------- BEGIN bootstrap applet -----------# -java16required=Dieses Applet ben\u00F6tigt Java Version 1.6 oder h\u00F6her. \ - Bitte installieren sie eine aktulle Version von Java. \ -

F\u00FCr Windows, Linux and Solaris kann Java von \ - http://java.sun.com/javase/downloads \ - heruntergeladen werden.

- -failedtostart=Das Applet konnte nicht gestartet werden. \ -

{0}

-# -------- END bootstrap applet -----------# - -applet.name=Online B\u00FCrgerkartenumgebung (BKU) - -nopcscsupport=Die Java-Installation stellt keine \ - PC/SC-Schnittstelle zum Zugriff auf eine Chipkarte zur Verf\u00FCgung. - -nocardterminal=Es konnte kein Chipkartenleser gefunden werden.\ -

Entweder, es ist kein Chipkartenleser angeschlossen, oder \ - f\u00FCr den angeschlossenen Chipkartenleser ist kein PC/SC-Treiber \ - installiert.

- -insertcard=Bitte stecken Sie ihre B\u00FCrgerkarte in den Chipkartenleser. - -unsupportedcard=Die gesteckte Chipkarte wird nicht unterst\u00FCtzt.\ -

Bitte stecken Sie ihre B\u00FCrgerkare in den Chipkartenleser

- -failed.WS=Das Webservice kann nicht erreicht werden. \ No newline at end of file diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index 2e6b7b14..aeabc5c1 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -13,49 +13,50 @@ # See the License for the specific language governing permissions and # limitations under the License. -title.welcome=Welcome -title.insertcard=Please insert your citizen-card into the reader -title.cardnotsupported=This card is not supported -title.cardpin=Enter {0} -title.sign=Create signature -title.error=Error -title.retry=Wrong PIN -title.wait=Please wait -title.hashdata=Signature data -windowtitle.save=Save signature data -windowtitle.savedir=Save signature data to directory -windowtitle.overwrite=Overwrite file? -message.wait=Please wait... -message.insertcard=Please insert your citizen-card into the reader -message.enterpin=Enter {0} -message.hashdatalink=Display signature data -message.hashdata=Signature data: -message.hashdatalist={0} signature data objects: -message.retries={0} tries left -message.overwrite=Overwrite {0}? +title.welcome=Willkommen +title.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken +title.cardnotsupported=Die Karte wird nicht unterst\u00FCtzt +title.cardpin={0} eingeben +title.sign=Signatur erstellen +title.error=Fehler +title.retry=Falscher PIN +title.wait=Bitte warten +title.hashdata=Signaturdaten +windowtitle.save=Signaturdaten speichern +windowtitle.savedir=Signaturdaten in Verzeichnis speichern +windowtitle.overwrite=Datei \u00FCberschreiben? +message.wait=Bitte warten... +message.insertcard=Bitte die B\u00FCrgerkarte in den Kartenleser stecken +message.enterpin={0} eingeben +message.hashdatalink=Signaturdaten anzeigen +message.hashdata=Signaturdaten: +message.hashdatalist={0} Signaturdaten: +message.retries=Noch {0} Versuch(e) +message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben? label.pin={0}: -label.pinsize=({0} digits) +label.pinsize=({0} stellig) button.ok=OK -button.cancel=Cancel -button.back=Back -button.sign=Sign -button.save=Save... -mimetype.desc.xml=XML-files (.xml) -mimetype.desc.html=HTML-files (.html, .htm) -mimetype.desc.xhtml=XHTML-files (.xhtml) -mimetype.desc.txt=Textfiles (.txt) -mimetype.desc.pdf=Adobe PDF-files (.pdf) -mimetype.desc.bin=Binary files (.bin) -save.hashdatainput.prefix=signaturedata +button.cancel=Abbrechen +button.back=Zur\u00FCck +button.sign=Signieren +button.save=Speichern... +mimetype.desc.xml=XML-Dateien (.xml) +mimetype.desc.html=HTML-Dateien (.html, .htm) +mimetype.desc.xhtml=XHTML-Dateien (.xhtml) +mimetype.desc.txt=Textdateien (.txt) +mimetype.desc.pdf=Adobe PDF-Dateien (.pdf) +mimetype.desc.bin=Bin\u00E4rdateien (.bin) +save.hashdatainput.prefix=Signaturdaten # Error Messages -error.no.hashdata=No signature data available: {0} -error.display.hashdata=Could not display signature data: {0} -error.write.hashdata=Could not save signature data: {0} -error.invalid.hash=Invalid signature data: {0} -error.ws.unreachable=Web-service unreachable: {0} -error.pcsc=No PC/SC interface for smartcard access provided -error.cardterminal=Could not find smartcard reader -error.unknown=An error occured: {0} -error.card.locked=Citizen-card is locked -error.card.notactivated=Citizen-card not activated \ No newline at end of file +error.no.hashdata=Keine Signaturdaten verf\u00FCgbar: {0} +error.display.hashdata=Signaturdaten konnten nicht dargestellt werden: {0} +error.write.hashdata=Die Signaturdaten konnten nicht gespeichert werden: {0} +error.invalid.hash=Die Signaturdaten sind ung\u00FCltig: {0} +error.ws.unreachable=Das Web-Service ist nicht erreichbar: {0} +error.pcsc=Es konnte keine PC/SC Schnittstelle gefunden werden +error.cardterminal=Es konnte kein Smartcard-Leser gefunden werden +error.unknown=Leider trat ein Fehler auf: {0} +error.test=Fehler1 {0} - Fehler2 {1} +error.card.locked=B\u00FCrgerkarte ist gesperrt +error.card.notactivated=B\u00FCrgerkartenfunktion ist nicht aktiviert \ No newline at end of file diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties deleted file mode 100644 index af0cb016..00000000 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright 2008 Federal Chancellery Austria and -# Graz University of Technology -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -title.welcome=Willkommen -title.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken -title.cardnotsupported=Die Karte wird nicht unterst\u00FCtzt -title.cardpin={0} eingeben -title.sign=Signatur erstellen -title.error=Fehler -title.retry=Falscher PIN -title.wait=Bitte warten -title.hashdata=Signaturdaten -windowtitle.save=Signaturdaten speichern -windowtitle.savedir=Signaturdaten in Verzeichnis speichern -windowtitle.overwrite=Datei \u00FCberschreiben? -message.wait=Bitte warten... -message.insertcard=Bitte die B\u00FCrgerkarte in den Kartenleser stecken -message.enterpin={0} eingeben -message.hashdatalink=Signaturdaten anzeigen -message.hashdata=Signaturdaten: -message.hashdatalist={0} Signaturdaten: -message.retries=Noch {0} Versuch(e) -message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben? -label.pin={0}: -label.pinsize=({0} stellig) -button.ok=OK -button.cancel=Abbrechen -button.back=Zur\u00FCck -button.sign=Signieren -button.save=Speichern... -mimetype.desc.xml=XML-Dateien (.xml) -mimetype.desc.html=HTML-Dateien (.html, .htm) -mimetype.desc.xhtml=XHTML-Dateien (.xhtml) -mimetype.desc.txt=Textdateien (.txt) -mimetype.desc.pdf=Adobe PDF-Dateien (.pdf) -mimetype.desc.bin=Bin\u00E4rdateien (.bin) -save.hashdatainput.prefix=Signaturdaten - -# Error Messages -error.no.hashdata=Keine Signaturdaten verf\u00FCgbar: {0} -error.display.hashdata=Signaturdaten konnten nicht dargestellt werden: {0} -error.write.hashdata=Die Signaturdaten konnten nicht gespeichert werden: {0} -error.invalid.hash=Die Signaturdaten sind ung\u00FCltig: {0} -error.ws.unreachable=Das Web-Service ist nicht erreichbar: {0} -error.pcsc=Java(TM) scheint keine PC/SC Schnittstelle f\u00FCr den Smartcard-Zugriff zur Verf\u00FCgung zu stellen. -error.cardterminal=Es konnte kein Smartcard-Leser gefunden werden.

Entweder ist kein Leser angeschlossen oder kein PC/SC Treiber installiert.

-error.unknown=Leider trat ein Fehler auf: {0} -error.test=Fehler1 {0} - Fehler2 {1} -error.card.locked=B\u00FCrgerkarte ist gesperrt -error.card.notactivated=B\u00FCrgerkartenfunktion ist nicht aktiviert \ No newline at end of file diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties new file mode 100644 index 00000000..3b8ac1bc --- /dev/null +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties @@ -0,0 +1,62 @@ +# Copyright 2008 Federal Chancellery Austria and +# Graz University of Technology +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +title.welcome=Welcome +title.insertcard=Please insert your citizen-card into the reader +title.cardnotsupported=This card is not supported +title.cardpin=Enter {0} +title.sign=Create signature +title.error=Error +title.retry=Wrong PIN +title.wait=Please wait +title.hashdata=Signature data +windowtitle.save=Save signature data +windowtitle.savedir=Save signature data to directory +windowtitle.overwrite=Overwrite file? +message.wait=Please wait... +message.insertcard=Please insert your citizen-card into the reader +message.enterpin=Enter {0} +message.hashdatalink=Display signature data +message.hashdata=Signature data: +message.hashdatalist={0} signature data objects: +message.retries={0} tries left +message.overwrite=Overwrite {0}? +label.pin={0}: +label.pinsize=({0} digits) +button.ok=OK +button.cancel=Cancel +button.back=Back +button.sign=Sign +button.save=Save... +mimetype.desc.xml=XML-files (.xml) +mimetype.desc.html=HTML-files (.html, .htm) +mimetype.desc.xhtml=XHTML-files (.xhtml) +mimetype.desc.txt=Textfiles (.txt) +mimetype.desc.pdf=Adobe PDF-files (.pdf) +mimetype.desc.bin=Binary files (.bin) +save.hashdatainput.prefix=signaturedata + +# Error Messages +error.no.hashdata=No signature data available: {0} +error.display.hashdata=Could not display signature data: {0} +error.write.hashdata=Could not save signature data: {0} +error.invalid.hash=Invalid signature data: {0} +error.ws.unreachable=Web-service unreachable: {0} +error.pcsc=No PC/SC interface for smartcard access provided +error.cardterminal=Could not find smartcard reader +error.unknown=An error occured: {0} +error.test=Error1 {0} - Error2 {1} +error.card.locked=Citizen-card is locked +error.card.notactivated=Citizen-card not activated \ No newline at end of file diff --git a/bkucommon/src/main/resources/at/gv/egiz/bku/slexceptions/SLExceptionMessages_de.properties b/bkucommon/src/main/resources/at/gv/egiz/bku/slexceptions/SLExceptionMessages_de.properties deleted file mode 100644 index 73409c8b..00000000 --- a/bkucommon/src/main/resources/at/gv/egiz/bku/slexceptions/SLExceptionMessages_de.properties +++ /dev/null @@ -1,99 +0,0 @@ -# Copyright 2008 Federal Chancellery Austria and -# Graz University of Technology -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -test.noerror=Das ist eine Test-Fehlermeldung. Es ist kein Fehler aufgetreten. - -ec1000=Unklassifizierter Fehler. -ec2000=Unklassifizierter Fehler in der Transportbindung. -ec2001=HTTP/HTTPS-Bindung: DataURL kann nicht aufgelst werden. -ec2002=HTTP/HTTPS-Bindung: StylesheetURL kann nicht aufgelst werden. -ec2003=HTTP/HTTPS-Bindung: RedirectURL kann nicht aufgelst werden. -ec2004=HTTP/HTTPS-Bindung: Parameter XMLRequest fehlt. -ec2005=HTTP/HTTPS-Bindung: Unbekannte Kodierung der Parameter. -ec2006=HTTP/HTTPS-Bindung: Fehlerhafte Kodierung der Parameter. -ec2007=HTTP/HTTPS-Bindung: DataURL-Server sendet Fehler oder unerwartete Antwort. -ec2008=HTTP/HTTPS-Bindung: Fehler im Stylesheet, der von der StylesheetURL bezogen wurde. -ec2009=HTTP/HTTPS-Bindung: HTTP-Anfrage an lokale BKU wurde an unerlaubte URL gerichtet. -ec2010=HTTPS-Bindung: Fehler beim Aufbau der TLS-Verbindung. -ec3000=Unklassifizierter Fehler in der XML-Struktur der Befehlsanfrage. -ec3001=XML-Struktur der Befehlsanfrage ist nicht wohlgeformt. -ec3002=XML-Struktur der Befehlsanfrage entspricht nicht dem Schema des Security-Layers. -ec3003=XML-Struktur der Befehlsanfrage enthlt eine unerlaubte Kombination aus optionalen Elementen oder Attributen. -ec3004=XML-Struktur enthlt ein Element oder Attribut, dessen Syntax nicht der Spezifikation des Security-Layer entspricht. -ec3005=Protokollversion des Security-Layer wird nicht untersttzt. -ec4000=Unklassifizierter Fehler in der Befehlsabarbeitung. -ec4001=Unbekannter Keyboxbezeichner. -ec4002=Unbekannter Infoboxbezeichner. -ec4003=Zu signierendes Datum kann nicht aufgelst werden. -ec4004=Ergnzungsobjekt kann nicht aufgelst werden. -ec4005=Zu verschlsselndes Datum kann nicht aufgelst werden. -ec4006=Algorithmus (Signatur, Verschlsselung, Digest, Kanonisierung, Transformation) wird nicht untersttzt. -ec4007=Fehler bei der Algorithmusausfhrung (Signatur, Verschlsselung, Digest, Kanonisierung, Transformation). -ec4008=Fehler beim Parsen der CMS-Nachricht. -ec4009=Kein passender Entschlsselungsschlssel vorhanden. -ec4010=Parameter des Infobox-Befehls passen nicht zum Typ der Infobox. -ec4011=Befehl ist nicht implementiert. -ec4100=XML-Dokument, in das die Signatur integriert werden soll, kann nicht aufgelst werden. -ec4101=XML-Dokument, in das die Signatur integriert werden soll, kann nicht geparst werden. -ec4102=Signatur kann nicht am spezifizierten Ort in das bestehende XML-Dokument integriert werden. -ec4103=Signatorzertifikat ist nicht in der CMS-Signatur enthalten. -ec4104=Signierte Daten sind weder in der CMS-Signatur noch im XML-Request enthalten. -ec4105=XML-Dokument, das die zu prfende Signatur enthlt, kann nicht aufgelst werden. -ec4106=XML-Dokument, das die zu prfende Signatur enthlt, kann nicht geparst werden. -ec4107=Am spezifizierten Ort innerhalb des XML-Dokuments befindet sich keine XML-Signatur. -ec4108=Verschlsseltes Datum kann nicht am spezifizierten Ort in das bestehende XML-Dokument eingefgt werden. -ec4109=Bestehendes XML-Dokument ist notwendig, aber nicht vorhanden. -ec4110=Bestehendes XML-Dokument kann nicht aufgelst werden. -ec4111=Bestehendes XML-Dokument kann nicht geparst werden. -ec4112=Verschlsselte Datenverschlsselungsschlssel knnen nicht am spezifizierten Ort in das bestehende XML-Dokument eingefgt werden. -ec4113=Zu entschlsselnde Daten sind weder in der CMS-Nachricht noch im XML-Request enthalten. -ec4114=Zu entschlsselndes XML-Dokument kann nicht aufgelst werden. -ec4115=Zu entschlsselndes XML-Dokument kann nicht geparst werden. -ec4116=Zumindest ein spezifiziertes Verschlsselungselement kann nicht im zu entschlsselnden XML-Dokument gefunden werden. -ec4117=Kein Verschlsselungselement fr Binrantwort vorhanden. -ec4118=Zu hashendes Datum kann nicht aufgelst werden. -ec4119=Datum, fr das der Hashwert zu prfen ist, kann nicht aufgelst werden. -ec4120=Gewhlter Infoboxbezeichner bereits vergeben. -ec4121=Infobox mit spezifiziertem Bezeichner existiert nicht. -ec4122=Inhalt der ausgewhlten Infobox kann nicht als XML dargestellt werden. -ec4123=Assoziatives Array: Zum spezifizierten Schlssel existiert kein Eintrag. -ec4500=Die Sitzung ist abgelaufen. -ec5000=Unklassifizierter Fehler in der Anzeigekomponente. -ec5001=Anzeige von Daten des in der Befehlsanfrage angegebenen Mime-Types wird nicht untersttzt. -ec5002=Zeichenkodierung der anzuzeigenden Daten ist fehlerhaft oder wird nicht untersttzt. -ec5003=Anzuzeigende Daten enhalten nicht untersttzte Zeichen. -ec5004=Standardanzeigeformat: HTML ist nicht spezifikationskonform. -ec5005=Standardanzeigeformat: CSS ist nicht spezifikationskonform. -ec5006=Standardanzeigeformat: Format eines eingebundenen Bildes ist nicht spezifikationskonform. -ec5007=Standardanzeigeformat: Signatur ber eingebundene Bilder fehlt oder ist nicht spezifikationskonform. -ec6000=Unklassifizierter Abbruch durch den Brger. -ec6001=Abbruch durch den Brger ber die Benutzerschnittstelle. -ec6002=Abbruch auf Grund mangelnder Rechte zur Befehlsausfhrung. - -# 3xxx -# - -ec3000.unclassified=Unklassifizierter Fehler in der XML-Struktur der Befehlsanfrage. {0} -ec3002.invalid=XML-Struktur der Befehlsanfrage entspricht nicht dem Schema des Security-Layers. {0} - -# 4xxx -# - -ec4000.infobox.invalid=Die Infobox '{0}' enthlt ungltige Daten. -ec4000.idlink.transfomation.failed=Die komprimierte Personenbindung konnte mit dem Stylesheet {0} nicht transformiert werden. -ec4002.infobox.unknown=Unbekannter Infoboxbezeichner {0}. -ec4003.not.resolved=Zu signierendes Datum kann nicht aufgelst werden (URI={0}). -ec4011.notimplemented=Befehl {0} ist nicht implementiert. - diff --git a/smcc/src/main/java/at/gv/egiz/smcc/util/SMCCHelper.java b/smcc/src/main/java/at/gv/egiz/smcc/util/SMCCHelper.java index 15971497..4dae7975 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/util/SMCCHelper.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/util/SMCCHelper.java @@ -87,7 +87,7 @@ public class SMCCHelper { ATR atr = newCards.get(cardTerminal).getATR(); log.trace("Found supported card (" + signatureCard.toString() + ") " + "in terminal '" + cardTerminal.getName() + "', ATR = " - + toString(atr.getHistoricalBytes()) + "."); + + toString(atr.getBytes()) + "."); resultCode = CARD_FOUND; break; @@ -97,7 +97,7 @@ public class SMCCHelper { ATR atr = c.getATR(); log.info("Found unsupported card" + " in terminal '" + cardTerminal.getName() + "', ATR = " - + toString(atr.getHistoricalBytes()) + "."); + + toString(atr.getBytes()) + "."); } else { log.info("Found unsupported card in terminal '" + cardTerminal.getName() + "' without ATR"); diff --git a/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties b/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties index 9142841c..d2bbe4f9 100644 --- a/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties +++ b/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties @@ -17,5 +17,5 @@ # and open the template in the editor. dec.pin.name=Geheimhaltungs-PIN -sig.pin.name=Signature-PIN +sig.pin.name=Signatur-PIN inf.pin.name=Infobox-PIN diff --git a/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard_de.properties b/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard_de.properties deleted file mode 100644 index d2bbe4f9..00000000 --- a/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard_de.properties +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2008 Federal Chancellery Austria and -# Graz University of Technology -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# To change this template, choose Tools | Templates -# and open the template in the editor. - -dec.pin.name=Geheimhaltungs-PIN -sig.pin.name=Signatur-PIN -inf.pin.name=Infobox-PIN diff --git a/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard_en.properties b/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard_en.properties deleted file mode 100644 index 9142841c..00000000 --- a/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard_en.properties +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright 2008 Federal Chancellery Austria and -# Graz University of Technology -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# To change this template, choose Tools | Templates -# and open the template in the editor. - -dec.pin.name=Geheimhaltungs-PIN -sig.pin.name=Signature-PIN -inf.pin.name=Infobox-PIN diff --git a/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard.properties b/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard.properties index 77935333..6fa5f0fa 100644 --- a/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard.properties +++ b/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard.properties @@ -16,5 +16,5 @@ # To change this template, choose Tools | Templates # and open the template in the editor. -sig.pin.name=Signature-PIN -card.pin.name=Card-PIN +sig.pin.name=Signatur-PIN +card.pin.name=Karten-PIN diff --git a/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard_de.properties b/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard_de.properties deleted file mode 100644 index 6fa5f0fa..00000000 --- a/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard_de.properties +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2008 Federal Chancellery Austria and -# Graz University of Technology -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# To change this template, choose Tools | Templates -# and open the template in the editor. - -sig.pin.name=Signatur-PIN -card.pin.name=Karten-PIN diff --git a/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard_en.properties b/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard_en.properties deleted file mode 100644 index 77935333..00000000 --- a/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard_en.properties +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2008 Federal Chancellery Austria and -# Graz University of Technology -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# To change this template, choose Tools | Templates -# and open the template in the editor. - -sig.pin.name=Signature-PIN -card.pin.name=Card-PIN -- cgit v1.2.3 From c7c00fbb89717c2a3a51f64908ad78a61ae70da0 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 5 Nov 2008 10:05:54 +0000 Subject: BKUWorker refactoring jssessionId git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@148 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../gv/egiz/bku/online/applet/AppletBKUWorker.java | 205 +++++++++++ .../bku/online/applet/AppletParameterProvider.java | 57 ++++ .../at/gv/egiz/bku/online/applet/BKUApplet.java | 125 ++++--- .../at/gv/egiz/bku/online/applet/BKUWorker.java | 374 --------------------- .../applet/WebServiceSignRequestHandler.java | 2 +- .../at/gv/egiz/bku/local/stal/LocalBKUWorker.java | 31 ++ .../java/at/gv/egiz/bku/local/stal/SMCCSTAL.java | 4 +- .../at/gv/egiz/bku/smccstal/AbstractBKUWorker.java | 199 +++++++++++ 8 files changed, 575 insertions(+), 422 deletions(-) create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletParameterProvider.java delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java create mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java create mode 100644 smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java (limited to 'BKUApplet') diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java new file mode 100644 index 00000000..2141165b --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java @@ -0,0 +1,205 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.online.applet; + +import at.gv.egiz.bku.smccstal.AbstractBKUWorker; +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.SignRequest; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.STALService; +import at.gv.egiz.stal.service.types.ErrorResponseType; +import at.gv.egiz.stal.service.types.GetNextRequestResponseType; +import at.gv.egiz.stal.service.types.GetNextRequestType; +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 java.applet.AppletContext; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import javax.xml.namespace.QName; + +/** + * + * @author Clemens Orthacker + */ +public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { + + protected AppletContext ctx; + protected AppletParameterProvider params; + protected String sessionId; + protected STALPortType stalPort; + + public AppletBKUWorker(BKUGUIFacade gui, AppletContext ctx, AppletParameterProvider paramProvider) { + super(gui); + if (ctx == null) { + throw new NullPointerException("Applet context not provided"); + } + if (paramProvider == null) { + throw new NullPointerException("No applet parameters provided"); + } + this.ctx = ctx; + this.params = paramProvider; + + sessionId = params.getAppletParameter(BKUApplet.SESSION_ID); + if (sessionId == null) { + sessionId = "TestSession"; + log.info("using dummy sessionId " + sessionId); + } + } + + @Override + public void run() { + gui.showWelcomeDialog(); + try { + stalPort = getSTALPort(); + } catch (Exception e) { + log.fatal("Failed to get STAL web-service port: " + e.getMessage(), e); + actionCommandList.clear(); + actionCommandList.add("ok"); + gui.showErrorDialog(BKUGUIFacade.ERR_SERVICE_UNREACHABLE, + new Object[]{e.getMessage()}); + try { + waitForAction(); + } catch (InterruptedException e1) { + log.error(e1); + } + return; + } + + try { + registerSignRequestHandler(); + + ObjectFactory of = new ObjectFactory(); + + GetNextRequestResponseType nextRequestResp = stalPort.connect(sessionId); + do { + List requests = nextRequestResp.getInfoboxReadRequestOrSignRequestOrQuitRequest(); + List stalRequests = STALTranslator.translateRequests(requests); + + if (log.isInfoEnabled()) { + StringBuilder sb = new StringBuilder("Received "); + sb.append(stalRequests.size()); + sb.append(" STAL requests: "); + for (STALRequest r : stalRequests) { + sb.append(r.getClass()); + sb.append(' '); + } + log.info(sb.toString()); + } + + boolean handle = true; + for (STALRequest request : stalRequests) { + if (request instanceof at.gv.egiz.stal.InfoboxReadRequest) { + at.gv.egiz.stal.InfoboxReadRequest r = (at.gv.egiz.stal.InfoboxReadRequest) request; + String infoboxId = r.getInfoboxIdentifier(); + String domainId = r.getDomainIdentifier(); + if ("IdentityLink".equals(infoboxId) && domainId == null) { + if (!InternalSSLSocketFactory.getInstance().isEgovAgency()) { + handle = false; + } + } + } + } + + List responses; + if (handle) { + List stalResponses = handleRequest(stalRequests); + if (log.isInfoEnabled()) { + StringBuilder sb = new StringBuilder(stalResponses.size()); + sb.append(" STAL responses: "); + for (STALResponse r : stalResponses) { + sb.append(r.getClass()); + sb.append(' '); + } + log.info(sb.toString()); + } + responses = STALTranslator.fromSTAL(stalResponses); + } else { + responses = new ArrayList(1); + ErrorResponseType err = of.createErrorResponseType(); + err.setErrorCode(6002); + // err.setErrorMessage(); + responses.add(err); + } + + if (!finished) { + log.info("Not finished yet (BKUWorker: " + this + "), sending responses"); + GetNextRequestType nextRequest = of.createGetNextRequestType(); + nextRequest.setSessionId(sessionId); + nextRequest.getInfoboxReadResponseOrSignResponseOrErrorResponse().addAll(responses); + nextRequestResp = stalPort.getNextRequest(nextRequest); + } + } while (!finished); + log.info("Done " + Thread.currentThread().getName()); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[]{ex.getMessage()}); + try { + waitForAction(); + } catch (InterruptedException e) { + log.error(e); + } + } + if (signatureCard != null) { + signatureCard.disconnect(false); + } + sendRedirect(); + } + + protected void sendRedirect() { + try { + URL redirectURL = params.getURLParameter(BKUApplet.REDIRECT_URL, sessionId); + String redirectTarget = params.getAppletParameter(BKUApplet.REDIRECT_TARGET); + if (redirectTarget == null) { + log.info("Done. Redirecting to " + redirectURL + " ..."); + ctx.showDocument(redirectURL); + } else { + log.info("Done. Redirecting to " + redirectURL + " (target=" + redirectTarget + ") ..."); + ctx.showDocument(redirectURL, redirectTarget); + } + } catch (MalformedURLException ex) { + log.warn("Failed to redirect: " + ex.getMessage(), ex); + // gui.showErrorDialog(errorMsg, okListener, actionCommand) + } + } + + private STALPortType getSTALPort() throws MalformedURLException { + URL wsdlURL = params.getURLParameter(BKUApplet.WSDL_URL); + log.debug("STAL WSDL at " + wsdlURL); + QName endpointName = new QName(BKUApplet.STAL_WSDL_NS, BKUApplet.STAL_SERVICE); + STALService stal = new STALService(wsdlURL, endpointName); + return stal.getSTALPort(); + } + + private void registerSignRequestHandler() throws MalformedURLException { + String hashDataDisplayStyle = params.getAppletParameter(BKUApplet.HASHDATA_DISPLAY); + if (BKUApplet.HASHDATA_DISPLAY_INTERNAL.equals(hashDataDisplayStyle)) { + log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL); + addRequestHandler(SignRequest.class, new WebServiceSignRequestHandler(stalPort, sessionId)); + } else { + //if (HASHDATADISPLAY_EXTERNAL.equals(displayStyle)) { + URL hashDataURL = params.getURLParameter(BKUApplet.HASHDATA_URL, sessionId); + log.debug("register SignRequestHandler for HashDataURL " + hashDataURL); + addRequestHandler(SignRequest.class, new ExternalDisplaySignRequestHandler(ctx, hashDataURL)); + } + } +} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletParameterProvider.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletParameterProvider.java new file mode 100644 index 00000000..42e2d6ff --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletParameterProvider.java @@ -0,0 +1,57 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.online.applet; + +import java.net.MalformedURLException; +import java.net.URL; + +/** + * + * @author Clemens Orthacker + */ +public interface AppletParameterProvider { + + /** + * Applet configuration parameters + * + * @param paramKey + * @return null if no parameter is provided for the given key + */ + String getAppletParameter(String paramKey); + + /** + * Get applet configuration parameter as (absolute) URL + * + * @param paramKey + * @return a URL + * @throws MalformedURLException if configured URL is invalid + * or no parameter is provided for the given key + */ + URL getURLParameter(String paramKey) throws MalformedURLException; + + /** + * Get applet configuration parameter as (absolute) URL + * + * @param paramKey + * @param sessionId adds the jsessionid to the URL + * @return a URL + * @throws MalformedURLException if configured URL is invalid + * or no parameter is provided for the given key + */ + URL getURLParameter(String paramKey, String sessionId) throws MalformedURLException; +} 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 bde055ec..f3eecdf9 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 @@ -16,6 +16,7 @@ */ package at.gv.egiz.bku.online.applet; +import at.gv.egiz.bku.smccstal.AbstractBKUWorker; import java.net.MalformedURLException; import java.net.URL; import java.util.Locale; @@ -36,9 +37,13 @@ import at.gv.egiz.bku.gui.BKUGUIFactory; * Note: all swing code is executed by the event dispatch thread (see * BKUGUIFacade) */ -public class BKUApplet extends JApplet { +public class BKUApplet extends JApplet implements AppletParameterProvider { private static Log log = LogFactory.getLog(BKUApplet.class); + + /** + * Applet parameter keys + */ public static final String GUI_STYLE = "GuiStyle"; public final static String LOCALE_PARAM_KEY = "Locale"; public final static String LOGO_URL_KEY = "LogoURL"; @@ -51,42 +56,59 @@ 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 BKUWorker worker; + + /** + * STAL WSDL namespace and service name + */ + public static final String STAL_WSDL_NS = "http://www.egiz.gv.at/wsdl/stal"; + public static final String STAL_SERVICE = "STALService"; + + /** + * Dummy session id, used if no sessionId parameter is provided + */ + protected static final String TEST_SESSION_ID = "TestSession"; + + /** + * STAL + */ + protected AppletBKUWorker worker; protected Thread workerThread; - public BKUApplet() { - } - + /** + * Factory method to create and wire HelpListener, GUI and BKUWorker. + */ @Override public void init() { - log.info("Welcome to MOCCA\n"); + log.info("Welcome to MOCCA"); log.debug("Called init()"); + HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance()); - String locale = getMyAppletParameter(LOCALE_PARAM_KEY); - if (locale != null) { - this.setLocale(new Locale(locale)); - } - String backgroundString = getMyAppletParameter(BACKGROUND_PARAM); - URL background = null; - if (backgroundString != null) { - try { - background = new URL(backgroundString); - } catch (MalformedURLException ex) { - log.warn(ex.getMessage() + ", using default background"); - } + + String locale = getAppletParameter(LOCALE_PARAM_KEY); + String guiStyle = getAppletParameter(GUI_STYLE); + URL backgroundImgURL = null; + URL helpURL = null; + try { + helpURL = getURLParameter(HELP_URL, getAppletParameter(SESSION_ID)); + } catch (MalformedURLException ex) { + log.warn("failed to load help URL, disabling help: " + ex.getMessage()); } - 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, getLocale()); + backgroundImgURL = getURLParameter(BACKGROUND_PARAM); } catch (MalformedURLException ex) { - log.error("invalid help URL: " + ex.getMessage()); + log.info("failed to load applet background image, using default: " + ex.getMessage()); } - gui.init(getContentPane(), getLocale(), background, helpListener); - worker = new BKUWorker(gui, this); + + if (locale != null) { + this.setLocale(new Locale(locale)); + } + log.debug("setting locale to " + getLocale()); + + BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle); + AppletHelpListener helpListener = new AppletHelpListener(getAppletContext(), helpURL, getLocale()); + gui.init(getContentPane(), getLocale(), backgroundImgURL, helpListener); + + worker = new AppletBKUWorker(gui, getAppletContext(), this); } @Override @@ -109,30 +131,43 @@ public class BKUApplet extends JApplet { log.debug("Called destroy()"); } - /** - * Applet configuration parameters - * - * @param paramKey - * @return - */ - String getMyAppletParameter(String paramKey) { - log.info("Getting parameter: " + paramKey + ": " + getParameter(paramKey)); - return getParameter(paramKey); + @Override + public String getAppletParameter(String paramKey) { + String param = getParameter(paramKey); + log.info("applet parameter: " + paramKey + ": " + param); + return param; } - URL getMyAppletParameterURL(String param) throws MalformedURLException { - String hashDataParam = getMyAppletParameter(param); //BKUApplet.HASHDATA_URL); - if (hashDataParam != null) { + @Override + public URL getURLParameter(String paramKey, String sessionId) throws MalformedURLException { + String urlParam = getParameter(paramKey); + if (urlParam != null) { URL codebase = getCodeBase(); try { - return new URL(codebase, hashDataParam); + URL url; + if (codebase.getProtocol().equalsIgnoreCase("file")) { + // for debugging in appletrunner + url = new URL(urlParam); + } else { + if (sessionId != null) { + urlParam = urlParam + ";jsessionid=" + sessionId; + } + url = new URL(codebase, urlParam); + } + log.info("applet parameter " + url); + return url; } catch (MalformedURLException ex) { - log.error("Paremeter " + param + " is not a valid URL.", ex); - throw new MalformedURLException(ex.getMessage()); - } + log.error("applet paremeter " + urlParam + " is not a valid URL: " + ex.getMessage()); + throw ex; + } } else { - log.error("Paremeter " + param + " not set"); - throw new MalformedURLException(param + " not set"); + log.error("applet paremeter " + urlParam + " not set"); + throw new MalformedURLException(urlParam + " not set"); } } + + @Override + public URL getURLParameter(String paramKey) throws MalformedURLException { + return getURLParameter(paramKey, null); + } } 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 deleted file mode 100644 index 843f6c4c..00000000 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java +++ /dev/null @@ -1,374 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package at.gv.egiz.bku.online.applet; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.ResourceBundle; - -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.xml.namespace.QName; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.bku.gui.BKUGUIFacade; -import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; -import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; -import at.gv.egiz.smcc.SignatureCard; -import at.gv.egiz.smcc.util.SMCCHelper; -import at.gv.egiz.stal.QuitRequest; -import at.gv.egiz.stal.STALRequest; -import at.gv.egiz.stal.STALResponse; -import at.gv.egiz.stal.service.STALPortType; -import at.gv.egiz.stal.service.STALService; -import at.gv.egiz.stal.service.types.ErrorResponseType; -import at.gv.egiz.stal.service.types.GetNextRequestResponseType; -import at.gv.egiz.stal.service.types.GetNextRequestType; -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; - -public class BKUWorker extends AbstractSMCCSTAL implements Runnable, - ActionListener, SMCCSTALRequestHandler { - - private static Log log = LogFactory.getLog(BKUWorker.class); - protected BKUGUIFacade gui; - protected BKUApplet parent; - private STALPortType stalPort; - protected List actionCommandList = new ArrayList(); - protected Boolean actionPerformed = false; - protected boolean finished = false; - - /** - * - * @param gui - * must not be 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; - addRequestHandler(QuitRequest.class, this); - // register SignRequestHandler once we have a webservice port - } - - /** - * Used for non applet variants - * - * @param gui - * @param errorMessageBundle - */ - protected BKUWorker(BKUGUIFacade gui) { - this.gui = gui; - this.locale = gui.getLocale(); - addRequestHandler(QuitRequest.class, this); - } - - private STALPortType getSTALPort() throws MalformedURLException { - URL wsdlURL = null; - String wsdlLocation = parent.getMyAppletParameter(BKUApplet.WSDL_URL); - URL codebase = parent.getCodeBase(); - log.debug("Connecting to webservice: " + wsdlLocation); - if (wsdlLocation != null) { - try { - if (codebase.getProtocol().equalsIgnoreCase("file")) { - // for debugging in appletrunner - wsdlURL = new URL(wsdlLocation); - } else { - wsdlURL = new URL(codebase, wsdlLocation); - } - } catch (MalformedURLException ex) { - log.fatal("Paremeter 'wsdlLocation' is not a vailid URL.", ex); - throw new MalformedURLException(ex.getMessage()); - } - } else { - log.fatal("Paremeter 'wsdlLocation' is not set."); - throw new MalformedURLException("Null WSDL url"); - } - log.debug("Found WSDL url: " + wsdlURL); - QName endpointName = new QName("http://www.egiz.gv.at/wsdl/stal", - "STALService"); - STALService stal = new STALService(wsdlURL, endpointName); - return stal.getSTALPort(); - } - - @Override - public void run() { - gui.showWelcomeDialog(); - try { - stalPort = getSTALPort(); - } catch (Exception e) { - log.fatal("Failed to call STAL service.", e); - actionCommandList.clear(); - actionCommandList.add("ok"); - gui.showErrorDialog(BKUGUIFacade.ERR_SERVICE_UNREACHABLE, - new Object[] { e.getMessage() }); - try { - waitForAction(); - } catch (InterruptedException e1) { - log.error(e1); - } - return; - } - - try { - String sessionId = parent.getMyAppletParameter(BKUApplet.SESSION_ID); - if (sessionId == null) { - // use the testsession for testing - sessionId = "TestSession"; - } - - String hashDataDisplayStyle = parent.getMyAppletParameter(BKUApplet.HASHDATA_DISPLAY); - if (BKUApplet.HASHDATA_DISPLAY_INTERNAL.equals(hashDataDisplayStyle)) { - log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL); - addRequestHandler(at.gv.egiz.stal.SignRequest.class, new WebServiceSignRequestHandler(sessionId, stalPort)); - } else { //if (HASHDATADISPLAY_EXTERNAL.equals(displayStyle)) { - URL hashDataURL = parent.getMyAppletParameterURL(BKUApplet.HASHDATA_URL); - log.debug("register SignRequestHandler for HashDataURL " + hashDataURL); - addRequestHandler(at.gv.egiz.stal.SignRequest.class, new ExternalDisplaySignRequestHandler(parent.getAppletContext(), hashDataURL)); - } - -// log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL); -// addRequestHandler(at.gv.egiz.stal.SignRequest.class, new WebServiceSignRequestHandler(sessionId, stalPort)); - - ObjectFactory of = new ObjectFactory(); - GetNextRequestResponseType nextRequestResp = stalPort.connect(sessionId); - do { - List requests = nextRequestResp - .getInfoboxReadRequestOrSignRequestOrQuitRequest(); - List stalRequests = STALTranslator - .translateRequests(requests); - - if (log.isInfoEnabled()) { - StringBuilder sb = new StringBuilder("Received "); - sb.append(stalRequests.size()); - sb.append(" STAL requests: "); - for (STALRequest r : stalRequests) { - sb.append(r.getClass()); - sb.append(' '); - } - log.info(sb.toString()); - } - - boolean handle = true; - for (STALRequest request : stalRequests) { - if (request instanceof at.gv.egiz.stal.InfoboxReadRequest) { - at.gv.egiz.stal.InfoboxReadRequest r = (at.gv.egiz.stal.InfoboxReadRequest) request; - String infoboxId = r.getInfoboxIdentifier(); - String domainId = r.getDomainIdentifier(); - if ("IdentityLink".equals(infoboxId) && domainId == null) { - if (!InternalSSLSocketFactory.getInstance().isEgovAgency()) { - handle = false; - } - } - } - } - - List responses; - if (handle) { - List stalResponses = handleRequest(stalRequests); - if (log.isInfoEnabled()) { - StringBuilder sb = new StringBuilder(stalResponses.size()); - sb.append(" STAL responses: "); - for (STALResponse r : stalResponses) { - sb.append(r.getClass()); - sb.append(' '); - } - log.info(sb.toString()); - } - responses = STALTranslator.fromSTAL(stalResponses); - } else { - responses = new ArrayList(1); - ErrorResponseType err = new ErrorResponseType(); - err.setErrorCode(6002); - // err.setErrorMessage(); - responses.add(err); - } - - if (!finished) { - log.info("Not finished yet (BKUWorker: " + this - + "), sending responses"); - GetNextRequestType nextRequest = of.createGetNextRequestType(); - nextRequest.setSessionId(sessionId); - nextRequest.getInfoboxReadResponseOrSignResponseOrErrorResponse() - .addAll(responses); - nextRequestResp = stalPort.getNextRequest(nextRequest); - } - } while (!finished); - log.info("Done " + Thread.currentThread().getName()); - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] { ex - .getMessage() }); - try { - waitForAction(); - } catch (InterruptedException e) { - log.error(e); - } - } - if (signatureCard != null) { - signatureCard.disconnect(false); - } - sendRedirect(); - } - - protected void sendRedirect() { - log.info("Done, sending redirect to get BKU response"); - String redirectURL = parent.getMyAppletParameter(BKUApplet.REDIRECT_URL); - String redirectTarget = parent.getMyAppletParameter(BKUApplet.REDIRECT_TARGET); - log.info("Redirecting to: " + redirectURL + " target: " + redirectTarget); - URL url = null; - if (redirectURL != null) { - try { - url = new URL(parent.getCodeBase(), redirectURL + ";jsessionid=" - + parent.getMyAppletParameter(BKUApplet.SESSION_ID)); - } catch (MalformedURLException ex) { - log.warn("Parameter 'redirectURL': " + redirectURL - + " not a valid URL.", ex); - // gui.showErrorDialog(errorMsg, okListener, actionCommand) - } - if (url != null) { - if (redirectTarget == null) { - log.info("Done. Trying to redirect to " + url + " ..."); - parent.getAppletContext().showDocument(url); - } else { - log.info("Done. Trying to redirect to " + url + " (target=" - + redirectTarget + ") ..."); - parent.getAppletContext().showDocument(url, redirectTarget); - } - } - } else { - log.error("No redirect URL set"); - } - } - - protected synchronized void waitForAction() throws InterruptedException { - log.info("Waiting for Action"); - while (!actionPerformed) { - wait(); - } - actionPerformed = false; - } - - protected synchronized void actionOccured() { - log.info("Received Action"); - actionPerformed = true; - notifyAll(); - } - - @Override - public void actionPerformed(ActionEvent e) { - log.info("Action: " + e); - if (actionCommandList != null) { - if (actionCommandList.contains(e.getActionCommand())) { - actionOccured(); - } - } else { - actionOccured(); - } - } - - @Override - protected boolean waitForCard() { - SMCCHelper smccHelper = new SMCCHelper(); - actionCommandList.clear(); - actionCommandList.add("cancel"); - // while no sigcard found or cancel button pressed - int oldValue = SMCCHelper.PC_SC_NOT_SUPPORTED; // this is a save default - while ((signatureCard == null) && (!actionPerformed)) { - switch (smccHelper.getResultCode()) { - case SMCCHelper.PC_SC_NOT_SUPPORTED: - actionCommandList.clear(); - actionCommandList.add("ok"); - gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, this, "ok"); - try { - waitForAction(); - } catch (InterruptedException e) { - log.error(e); - } - return true; - case SMCCHelper.TERMINAL_NOT_PRESENT: - actionCommandList.clear(); - actionCommandList.add("ok"); - gui.showErrorDialog(BKUGUIFacade.ERR_NO_CARDTERMINAL, null, this, "ok"); - try { - waitForAction(); - } catch (InterruptedException e) { - log.error(e); - } - return true; - case SMCCHelper.CARD_NOT_SUPPORTED: - if (oldValue != SMCCHelper.CARD_NOT_SUPPORTED) { - actionCommandList.clear(); - actionCommandList.add("cancel"); - gui.showCardNotSupportedDialog(this, "cancel"); - oldValue = SMCCHelper.CARD_NOT_SUPPORTED; - } - break; - case SMCCHelper.NO_CARD: - if (oldValue != SMCCHelper.NO_CARD) { - actionCommandList.clear(); - actionCommandList.add("cancel"); - gui.showInsertCardDialog(this, "cancel"); - oldValue = SMCCHelper.NO_CARD; - } - break; - case SMCCHelper.CARD_FOUND: - signatureCard = smccHelper.getSignatureCard(locale); - return false; - } - smccHelper.update(3000); - } - return signatureCard == null; - } - - @Override - public STALResponse handleRequest(STALRequest request) { - if (request instanceof QuitRequest) { - log.info("Setting state to: finished for BKUWorker " + this); - finished = true; - } else { - log.error("Unexpected request to handle: " + request); - } - return null; - } - - @Override - public void init(SignatureCard sc, BKUGUIFacade gui) { - } - - @Override - public boolean requireCard() { - return false; - } - - @Override - protected BKUGUIFacade getGUI() { - return gui; - } - -} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java index ddbe76bf..014065f2 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java @@ -45,7 +45,7 @@ public class WebServiceSignRequestHandler extends SignRequestHandler { STALPortType stalPort; String sessId; - public WebServiceSignRequestHandler(String sessId, STALPortType stalPort) { + public WebServiceSignRequestHandler(STALPortType stalPort, String sessId) { if (stalPort == null || sessId == null) { throw new NullPointerException("STAL port must not be null"); } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java new file mode 100644 index 00000000..10fb3e60 --- /dev/null +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java @@ -0,0 +1,31 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.local.stal; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.bku.smccstal.AbstractBKUWorker; + +/** + * + * @author Clemens Orthacker + */ +public class LocalBKUWorker extends AbstractBKUWorker { + + public LocalBKUWorker(BKUGUIFacade gui) { + super(gui); + } +} diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java index 6bf37c40..716050d6 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTAL.java @@ -5,13 +5,13 @@ import java.util.List; import javax.swing.JDialog; import at.gv.egiz.bku.gui.BKUGUIFacade; -import at.gv.egiz.bku.online.applet.BKUWorker; +import at.gv.egiz.bku.smccstal.AbstractBKUWorker; import at.gv.egiz.stal.QuitRequest; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; -public class SMCCSTAL extends BKUWorker { +public class SMCCSTAL extends AbstractBKUWorker { private JDialog container; diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java new file mode 100644 index 00000000..e10ba8f9 --- /dev/null +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java @@ -0,0 +1,199 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.smccstal; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.ArrayList; +import java.util.List; + + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.smcc.SignatureCard; +import at.gv.egiz.smcc.util.SMCCHelper; +import at.gv.egiz.stal.QuitRequest; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; + +/** + * Abstract base class for AppletBKUWorker and LocalBKUWorker, + * providing card specific functionality not implemented by AbstractSMCCSTAL + * as well as common GUI functionality (action event handling). + *
+ * This class implements SMCCSTALRequestHandler and registers itself as QUIT handler. + * + * @author Clemens Orthacker + */ +public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements ActionListener, SMCCSTALRequestHandler { + + protected static Log log = LogFactory.getLog(AbstractBKUWorker.class); + protected BKUGUIFacade gui; + protected List actionCommandList = new ArrayList(); + protected Boolean actionPerformed = false; + protected boolean finished = false; + + public AbstractBKUWorker(BKUGUIFacade gui) { + if (gui == null) { + throw new NullPointerException("No BKU GUI provided"); + } + this.gui = gui; + this.locale = gui.getLocale(); + addRequestHandler(QuitRequest.class, this); + } + + /////////////////////////////////////////////////////////////////// + // Common action event handling // + /////////////////////////////////////////////////////////////////// + + /** + * notifies all registered handlers that an event occured + * @param e + */ + @Override + public void actionPerformed(ActionEvent e) { + log.info("Action: " + e); + if (actionCommandList != null) { + if (actionCommandList.contains(e.getActionCommand())) { + actionOccured(); + } + } else { + actionOccured(); + } + } + + /** + * register for notification on action event + * @throws java.lang.InterruptedException + */ + protected synchronized void waitForAction() throws InterruptedException { + log.info("Waiting for Action"); + while (!actionPerformed) { + wait(); + } + actionPerformed = false; + } + + protected synchronized void actionOccured() { + log.info("Received Action"); + actionPerformed = true; + notifyAll(); + } + + /////////////////////////////////////////////////////////////////// + // card specific implementations of AbstractSMCCSTAL // + /////////////////////////////////////////////////////////////////// + + @Override + protected boolean waitForCard() { + SMCCHelper smccHelper = new SMCCHelper(); + actionCommandList.clear(); + actionCommandList.add("cancel"); + // while no sigcard found or cancel button pressed + int oldValue = SMCCHelper.PC_SC_NOT_SUPPORTED; // this is a save default + while ((signatureCard == null) && (!actionPerformed)) { + switch (smccHelper.getResultCode()) { + case SMCCHelper.PC_SC_NOT_SUPPORTED: + actionCommandList.clear(); + actionCommandList.add("ok"); + gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, this, "ok"); + try { + waitForAction(); + } catch (InterruptedException e) { + log.error(e); + } + return true; + case SMCCHelper.TERMINAL_NOT_PRESENT: + actionCommandList.clear(); + actionCommandList.add("ok"); + gui.showErrorDialog(BKUGUIFacade.ERR_NO_CARDTERMINAL, null, this, "ok"); + try { + waitForAction(); + } catch (InterruptedException e) { + log.error(e); + } + return true; + case SMCCHelper.CARD_NOT_SUPPORTED: + if (oldValue != SMCCHelper.CARD_NOT_SUPPORTED) { + actionCommandList.clear(); + actionCommandList.add("cancel"); + gui.showCardNotSupportedDialog(this, "cancel"); + oldValue = SMCCHelper.CARD_NOT_SUPPORTED; + } + break; + case SMCCHelper.NO_CARD: + if (oldValue != SMCCHelper.NO_CARD) { + actionCommandList.clear(); + actionCommandList.add("cancel"); + gui.showInsertCardDialog(this, "cancel"); + oldValue = SMCCHelper.NO_CARD; + } + break; + case SMCCHelper.CARD_FOUND: + signatureCard = smccHelper.getSignatureCard(locale); + return false; + } + smccHelper.update(3000); + } + return signatureCard == null; + } + + @Override + protected BKUGUIFacade getGUI() { + return gui; + } + + /////////////////////////////////////////////////////////////////// + // SMCCSTALRequestHandler for QUIT requests // + /////////////////////////////////////////////////////////////////// + + /** + * Handle QUIT requests: set finished true. + * @param request a QUIT request + * @return null (no response on QUIT) + */ + @Override + public STALResponse handleRequest(STALRequest request) { + if (request instanceof QuitRequest) { + log.info("Setting state to: finished for BKUWorker " + this); + finished = true; + } else { + log.error("Unexpected request to handle: " + request); + } + return null; + } + + /** + * No initialization required for QUIT request handlers. + * @param sc + * @param gui + */ + @Override + public void init(SignatureCard sc, BKUGUIFacade gui) { + } + + /** + * QUIT request handlers do not require a card. + * @return false + */ + @Override + public boolean requireCard() { + return false; + } +} -- cgit v1.2.3 From 2cf6fcb31e85b0e3b367121219932ec86b205da8 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 5 Nov 2008 14:42:05 +0000 Subject: help jsp git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@151 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 2 +- .../at/gv/egiz/bku/gui/AbstractHelpListener.java | 45 +++++++++------------- BKUOnline/src/main/webapp/WEB-INF/web.xml | 11 ++++-- BKUOnline/src/main/webapp/appletPage.jsp | 2 +- BKUOnline/src/main/webapp/help.jsp | 7 ++++ BKUOnline/src/main/webapp/helpfiles/index.html | 17 ++++++++ 6 files changed, 53 insertions(+), 31 deletions(-) create mode 100644 BKUOnline/src/main/webapp/help.jsp create mode 100644 BKUOnline/src/main/webapp/helpfiles/index.html (limited to 'BKUApplet') 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 f3eecdf9..4eab7e89 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 @@ -89,7 +89,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { URL backgroundImgURL = null; URL helpURL = null; try { - helpURL = getURLParameter(HELP_URL, getAppletParameter(SESSION_ID)); + helpURL = getURLParameter(HELP_URL); //, getAppletParameter(SESSION_ID)); } catch (MalformedURLException ex) { log.warn("failed to load help URL, disabling help: " + ex.getMessage()); } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java index 6e3167c1..a249a376 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java @@ -32,39 +32,22 @@ import org.apache.commons.logging.LogFactory; public abstract class AbstractHelpListener implements ActionListener { protected final static Log log = LogFactory.getLog(AbstractHelpListener.class); - protected String helpURLBase; +// protected String helpURLBase; + protected URL baseURL; protected Locale locale; public AbstractHelpListener(URL baseURL, Locale locale) { if (baseURL == null || "".equals(baseURL)) { throw new RuntimeException("no help URL provided"); } - this.helpURLBase = baseURL.toString(); + this.baseURL = baseURL; this.locale = locale; } @Override public void actionPerformed(ActionEvent e) { log.debug("received help action: " + e.getActionCommand()); - URL helpURL; - try { - String urlString = helpURLBase; - if (locale != null) { - urlString = appendParameter(urlString, "locale", locale.toString()); - } - if (e.getActionCommand() != null && !"".equals(e.getActionCommand())) { - urlString = appendParameter(urlString, "topic", e.getActionCommand()); - } - helpURL = new URL(urlString); - } catch (MalformedURLException ex) { - try { - log.error("failed to create help URL: " + ex.getMessage()); - helpURL = new URL(helpURLBase); - } catch (MalformedURLException ex1) { - log.error("failed to create default help URL, requested help will not be displayed"); - return; - } - } + URL helpURL = constructHelpURL(baseURL, e.getActionCommand()); try { showDocument(helpURL); } catch (Exception ex) { @@ -72,12 +55,22 @@ public abstract class AbstractHelpListener implements ActionListener { } } - private String appendParameter(String url, String paramName, String paramValue) { - if (url.indexOf('?') < 0) { - return url + "?" + paramName + "=" + paramValue; - } else { - return url + "&" + paramName + "=" + paramValue; + private URL constructHelpURL(URL baseURL, String helpItem) { + URL helpURL = baseURL; + log.trace("constructing help URL: " + helpURL); + try { + if (locale != null) { + helpURL = new URL(helpURL, locale.toString() + "/"); + log.trace("constructing help URL: " + helpURL); + } + if (helpItem != null && !"".equals(helpItem)) { + helpURL = new URL(helpURL, helpItem + ".html"); + log.trace("constructing help URL: " + helpURL); + } + } catch (MalformedURLException ex) { + log.error("Failed to construct help URL for help item " + helpItem + ": " + ex.getMessage()); } + return helpURL; } public abstract void showDocument(URL helpDocument) throws Exception; diff --git a/BKUOnline/src/main/webapp/WEB-INF/web.xml b/BKUOnline/src/main/webapp/WEB-INF/web.xml index 6b2ec35c..f6fdbefc 100644 --- a/BKUOnline/src/main/webapp/WEB-INF/web.xml +++ b/BKUOnline/src/main/webapp/WEB-INF/web.xml @@ -52,6 +52,10 @@ HashDataInputServlet at.gv.egiz.bku.online.webapp.HashDataInputServlet + + help + /help.jsp + BKUServlet /http-security-layer-request @@ -68,9 +72,10 @@ HashDataInputServlet /hashDataInput - - - + + help + /help/* + diff --git a/BKUOnline/src/main/webapp/appletPage.jsp b/BKUOnline/src/main/webapp/appletPage.jsp index 8ddbed13..ff52fe51 100644 --- a/BKUOnline/src/main/webapp/appletPage.jsp +++ b/BKUOnline/src/main/webapp/appletPage.jsp @@ -53,7 +53,7 @@ GuiStyle : '<%=guiStyle%>', Background : '<%=backgroundImg%>', WSDL_URL :'../stal?wsdl', - HelpURL : '../help', + HelpURL : '../help/', HashDataDisplay : 'external', HashDataURL : '../hashDataInput', SessionID : '<%=session.getId()%>', diff --git a/BKUOnline/src/main/webapp/help.jsp b/BKUOnline/src/main/webapp/help.jsp new file mode 100644 index 00000000..29343171 --- /dev/null +++ b/BKUOnline/src/main/webapp/help.jsp @@ -0,0 +1,7 @@ +<%-- + Document : help + Created on : 05.11.2008, 10:55:52 + Author : Clemens Orthacker +--%> + + diff --git a/BKUOnline/src/main/webapp/helpfiles/index.html b/BKUOnline/src/main/webapp/helpfiles/index.html new file mode 100644 index 00000000..84db59c6 --- /dev/null +++ b/BKUOnline/src/main/webapp/helpfiles/index.html @@ -0,0 +1,17 @@ + + + + + + + + + +

No help item provided

+ + + -- cgit v1.2.3 From 8171050e1b21733a5e55ce97ebc9134f6afb1abb Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 5 Nov 2008 17:22:51 +0000 Subject: java.awt.Desktop BROWSE for help and hashdatadisplay git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@152 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../gv/egiz/bku/online/applet/AppletBKUWorker.java | 2 +- .../egiz/bku/online/applet/AppletHelpListener.java | 35 +++++++++++++++------- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 6 +--- .../applet/ExternalDisplaySignRequestHandler.java | 27 ++++++++++++----- BKUApplet/src/test/resources/appletTest.html | 2 +- .../gv/egiz/bku/local/gui/LocalHelpListener.java | 1 + BKUOnline/src/main/webapp/helpfiles/index.html | 2 +- 7 files changed, 50 insertions(+), 25 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java index 2141165b..cf842d55 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java @@ -199,7 +199,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { //if (HASHDATADISPLAY_EXTERNAL.equals(displayStyle)) { URL hashDataURL = params.getURLParameter(BKUApplet.HASHDATA_URL, sessionId); log.debug("register SignRequestHandler for HashDataURL " + hashDataURL); - addRequestHandler(SignRequest.class, new ExternalDisplaySignRequestHandler(ctx, hashDataURL)); + addRequestHandler(SignRequest.class, new ExternalDisplaySignRequestHandler(hashDataURL)); // } } } diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java index 4040431f..743dc7ef 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java @@ -18,30 +18,45 @@ package at.gv.egiz.bku.online.applet; import at.gv.egiz.bku.gui.AbstractHelpListener; -import java.applet.AppletContext; +import java.awt.Desktop; import java.net.URL; import java.util.Locale; /** - * + * Now uses java.awt.Desktop, which deprecates + * the distinction between local and applet help listener + * TODO: integrate in AbstractHelpListener + * + * @deprecated * @author clemens */ public class AppletHelpListener extends AbstractHelpListener { - protected AppletContext ctx; +// protected AppletContext ctx; + protected Desktop desktop; - public AppletHelpListener(AppletContext ctx, URL helpURL, Locale locale) { + public AppletHelpListener(URL helpURL, Locale locale) { super(helpURL, locale); - if (ctx == null) { - throw new RuntimeException("no applet context provided"); +// if (ctx == null) { +// throw new RuntimeException("no applet context provided"); +// } +// this.ctx = ctx; + if (Desktop.isDesktopSupported()) { + this.desktop = Desktop.getDesktop(); } - this.ctx = ctx; } @Override public void showDocument(URL helpDocument) throws Exception { - ctx.showDocument(helpDocument, "_blank"); +// ctx.showDocument(helpDocument, "_blank"); + if (desktop == null) { + log.error("Failed to open default browser: Desktop API not available (libgnome installed?)"); + } else { + if (!desktop.isSupported(Desktop.Action.BROWSE)) { + log.error("Failed to open default browser: The system provides the Desktop API, but does not support the BROWSE action"); + } else { + Desktop.getDesktop().browse(helpDocument.toURI()); + } + } } - - } 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 4eab7e89..482273b0 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 @@ -16,14 +16,10 @@ */ package at.gv.egiz.bku.online.applet; -import at.gv.egiz.bku.smccstal.AbstractBKUWorker; import java.net.MalformedURLException; import java.net.URL; import java.util.Locale; -import java.util.ResourceBundle; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.net.ssl.HttpsURLConnection; import javax.swing.JApplet; @@ -105,7 +101,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { log.debug("setting locale to " + getLocale()); BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle); - AppletHelpListener helpListener = new AppletHelpListener(getAppletContext(), helpURL, getLocale()); + AppletHelpListener helpListener = new AppletHelpListener(helpURL, getLocale()); //getAppletContext(), gui.init(getContentPane(), getLocale(), backgroundImgURL, helpListener); worker = new AppletBKUWorker(gui, getAppletContext(), this); diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java index 2c9fde71..e4567a6c 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java @@ -17,7 +17,6 @@ package at.gv.egiz.bku.online.applet; -import java.applet.AppletContext; import java.net.URL; import java.util.List; @@ -26,28 +25,42 @@ import org.apache.commons.logging.LogFactory; import at.gv.egiz.bku.smccstal.SignRequestHandler; import at.gv.egiz.stal.signedinfo.ReferenceType; +import java.awt.Desktop; /** * - * @author clemens + * @author Clemens Orthacker */ public class ExternalDisplaySignRequestHandler extends SignRequestHandler { private static final Log log = LogFactory.getLog(ExternalDisplaySignRequestHandler.class); - AppletContext ctx; - URL hashDataURL; +// AppletContext ctx; + protected URL hashDataURL; + protected Desktop desktop; - public ExternalDisplaySignRequestHandler(AppletContext ctx, URL hashDataURL) { - this.ctx = ctx; + public ExternalDisplaySignRequestHandler(URL hashDataURL) { +// this.ctx = ctx; this.hashDataURL = hashDataURL; + if (Desktop.isDesktopSupported()) { + desktop = Desktop.getDesktop(); + } } @Override public void displayHashDataInputs(List signedReferences) throws Exception { //TODO pass reference Id's to servlet (TODO servlet) log.debug("displaying hashdata inputs at " + hashDataURL); - ctx.showDocument(hashDataURL, "_blank"); +// ctx.showDocument(hashDataURL, "_blank"); + if (desktop == null) { + log.error("Failed to open default browser: Desktop API not available (libgnome installed?)"); + } else { + if (!desktop.isSupported(Desktop.Action.BROWSE)) { + log.error("Failed to open default browser: The system provides the Desktop API, but does not support the BROWSE action"); + } else { + Desktop.getDesktop().browse(hashDataURL.toURI()); + } + } } } diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html index daf8445b..5aec1998 100644 --- a/BKUApplet/src/test/resources/appletTest.html +++ b/BKUApplet/src/test/resources/appletTest.html @@ -23,7 +23,7 @@ - + diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java index e32c9c3d..2251a474 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java @@ -25,6 +25,7 @@ import java.util.Locale; /** * + * @deprecated see AppletHelpListener * @author Clemens Orthacker */ public class LocalHelpListener extends AbstractHelpListener { diff --git a/BKUOnline/src/main/webapp/helpfiles/index.html b/BKUOnline/src/main/webapp/helpfiles/index.html index 84db59c6..49aaed66 100644 --- a/BKUOnline/src/main/webapp/helpfiles/index.html +++ b/BKUOnline/src/main/webapp/helpfiles/index.html @@ -11,7 +11,7 @@ -

No help item provided

+

Default help page if no help item is provided

-- cgit v1.2.3 From 1a459eb89e4e91308e1022abb8ddd0cae1d8e619 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 6 Nov 2008 12:24:24 +0000 Subject: error msg ws.unreachable dummy helplistener git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@153 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java | 6 +++--- .../src/main/resources/at/gv/egiz/bku/gui/Messages.properties | 3 ++- .../java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'BKUApplet') 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 482273b0..829cc79d 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 @@ -83,9 +83,10 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { String locale = getAppletParameter(LOCALE_PARAM_KEY); String guiStyle = getAppletParameter(GUI_STYLE); URL backgroundImgURL = null; - URL helpURL = null; + AppletHelpListener helpListener = null; try { - helpURL = getURLParameter(HELP_URL); //, getAppletParameter(SESSION_ID)); + URL helpURL = getURLParameter(HELP_URL); //, getAppletParameter(SESSION_ID)); + helpListener = new AppletHelpListener(helpURL, getLocale()); //getAppletContext(), } catch (MalformedURLException ex) { log.warn("failed to load help URL, disabling help: " + ex.getMessage()); } @@ -101,7 +102,6 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { log.debug("setting locale to " + getLocale()); BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle); - AppletHelpListener helpListener = new AppletHelpListener(helpURL, getLocale()); //getAppletContext(), gui.init(getContentPane(), getLocale(), backgroundImgURL, helpListener); worker = new AppletBKUWorker(gui, getAppletContext(), this); diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index aeabc5c1..2dc03491 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -53,7 +53,8 @@ error.no.hashdata=Keine Signaturdaten verf\u00FCgbar: {0} error.display.hashdata=Signaturdaten konnten nicht dargestellt werden: {0} error.write.hashdata=Die Signaturdaten konnten nicht gespeichert werden: {0} error.invalid.hash=Die Signaturdaten sind ung\u00FCltig: {0} -error.ws.unreachable=Das Web-Service ist nicht erreichbar: {0} +error.ws.unreachable=Der Server ist nicht erreichbar +#error.ws.unreachable=Das Web-Service ist nicht erreichbar: {0} error.pcsc=Es konnte keine PC/SC Schnittstelle gefunden werden error.cardterminal=Es konnte kein Smartcard-Leser gefunden werden error.unknown=Leider trat ein Fehler auf: {0} diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java index d5702e0e..19a56502 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java @@ -25,7 +25,6 @@ import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import at.gv.egiz.bku.smccstal.SMCCSTALRequestHandler; import at.gv.egiz.bku.smccstal.SignRequestHandler; import at.gv.egiz.stal.HashDataInput; import at.gv.egiz.stal.STALRequest; -- cgit v1.2.3 From 82c59c9d862d3ee9ad43fdc1509d0b5a61cc107c Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 11 Nov 2008 12:15:15 +0000 Subject: Frame HashData Display Interrupt in waitForAction (applet closed) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@161 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../gv/egiz/bku/online/applet/AppletBKUWorker.java | 12 +- .../bku/online/applet/AppletHashDataDisplay.java | 167 +++++++++++++ .../egiz/bku/online/applet/AppletHelpListener.java | 33 +-- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 4 +- .../bku/online/applet/BrowserHashDataDisplay.java | 52 +++++ .../applet/ExternalDisplaySignRequestHandler.java | 66 ------ .../bku/online/applet/JDialogHashDataDisplay.java | 221 ++++++++++++++++++ .../applet/WebServiceSignRequestHandler.java | 164 ------------- BKUApplet/src/main/resources/simplelog.properties | 2 +- BKUApplet/src/test/resources/appletTest.html | 4 +- .../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 2 +- .../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 5 +- .../java/at/gv/egiz/bku/gui/HashDataViewer.java | 260 +++++++++++++++++++++ .../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 38 ++- .../at/gv/egiz/bku/gui/Messages.properties | 2 + .../at/gv/egiz/bku/gui/Messages_en.properties | 2 + .../gv/egiz/bku/local/gui/LocalHelpListener.java | 1 - .../bku/local/stal/LocalSignRequestHandler.java | 4 +- BKUOnline/src/main/webapp/HTTP-ohne.html | 5 +- BKUOnline/src/main/webapp/appletPage.jsp | 4 +- 20 files changed, 773 insertions(+), 275 deletions(-) create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BrowserHashDataDisplay.java delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/JDialogHashDataDisplay.java delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java (limited to 'BKUApplet') diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java index cf842d55..8e88c012 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java @@ -31,6 +31,7 @@ import at.gv.egiz.stal.service.types.RequestType; import at.gv.egiz.stal.service.types.ResponseType; import at.gv.egiz.stal.util.STALTranslator; import java.applet.AppletContext; +import java.awt.Dimension; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; @@ -194,12 +195,15 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { String hashDataDisplayStyle = params.getAppletParameter(BKUApplet.HASHDATA_DISPLAY); if (BKUApplet.HASHDATA_DISPLAY_INTERNAL.equals(hashDataDisplayStyle)) { log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL); - addRequestHandler(SignRequest.class, new WebServiceSignRequestHandler(stalPort, sessionId)); - } else { - //if (HASHDATADISPLAY_EXTERNAL.equals(displayStyle)) { + addRequestHandler(SignRequest.class, new AppletHashDataDisplay(stalPort, sessionId)); + } else if (BKUApplet.HASHDATA_DISPLAY_BROWSER.equals(hashDataDisplayStyle)) { URL hashDataURL = params.getURLParameter(BKUApplet.HASHDATA_URL, sessionId); log.debug("register SignRequestHandler for HashDataURL " + hashDataURL); - addRequestHandler(SignRequest.class, new ExternalDisplaySignRequestHandler(hashDataURL)); // + addRequestHandler(SignRequest.class, new BrowserHashDataDisplay(ctx, hashDataURL)); + } else { + //BKUApplet.HASHDATA_DISPLAY_FRAME + log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL); + addRequestHandler(SignRequest.class, new JDialogHashDataDisplay(stalPort, sessionId, new Dimension(400, 300), locale)); } } } diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java new file mode 100644 index 00000000..b77485d9 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java @@ -0,0 +1,167 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.online.applet; + +import java.security.DigestException; +import java.security.MessageDigest; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.smccstal.SignRequestHandler; +import at.gv.egiz.stal.HashDataInput; +import at.gv.egiz.stal.impl.ByteArrayHashDataInput; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.types.GetHashDataInputResponseType; +import at.gv.egiz.stal.service.types.GetHashDataInputType; +import at.gv.egiz.stal.signedinfo.DigestMethodType; +import at.gv.egiz.stal.signedinfo.ReferenceType; + +/** + * A SignRequesthandler displaying hashdata inputs in the applet + * (only plaintext data is displayed, other hashdata inputs may be saved to disk). + * + * @author Clemens Orthacker + */ +public class AppletHashDataDisplay extends SignRequestHandler { + + private static final Log log = LogFactory.getLog(AppletHashDataDisplay.class); + STALPortType stalPort; + String sessId; + + public AppletHashDataDisplay(STALPortType stalPort, String sessId) { + if (stalPort == null || sessId == null) { + throw new NullPointerException("STAL port must not be null"); + } + this.sessId = sessId; + this.stalPort = stalPort; + } + + @Override + public void displayHashDataInputs(List signedReferences) throws Exception { + + GetHashDataInputType request = new GetHashDataInputType(); + request.setSessionId(sessId); + + HashMap idSignedRefMap = new HashMap(); + for (ReferenceType signedRef : signedReferences) { + //don't get Manifest, QualifyingProperties, ... + if (signedRef.getType() == null) { + String signedRefId = signedRef.getId(); + if (signedRefId != null) { + if (log.isTraceEnabled()) { + log.trace("requesting hashdata input for reference " + signedRefId); + } + idSignedRefMap.put(signedRefId, signedRef); + GetHashDataInputType.Reference ref = new GetHashDataInputType.Reference(); + ref.setID(signedRefId); + request.getReference().add(ref); + + } else { + throw new Exception("Cannot resolve HashDataInput for reference without Id attribute"); + } + } + } + + if (log.isDebugEnabled()) { + log.debug("Calling GetHashDataInput for " + request.getReference().size() + " references in session " + sessId); + } + GetHashDataInputResponseType response = stalPort.getHashDataInput(request); + ArrayList hashDataInputs = new ArrayList(); + + //hashdata inputs returned from service + HashMap idRefMap = new HashMap(); + for (GetHashDataInputResponseType.Reference reference : response.getReference()) { + String id = reference.getID(); + byte[] hdi = reference.getValue(); + if (hdi == null) { + throw new Exception("Did not receive hashdata input for reference " + id); + } + idRefMap.put(id, reference); + } + + for (String signedRefId : idSignedRefMap.keySet()) { + log.info("validating hashdata input for reference " + signedRefId); + + GetHashDataInputResponseType.Reference reference = idRefMap.get(signedRefId); + if (reference == null) { + throw new Exception("No hashdata input for reference " + signedRefId + " returned by service"); + } + +// } +// +// for (GetHashDataInputResponseType.Reference reference : response.getReference()) { +// +// String id = reference.getID(); + byte[] hdi = reference.getValue(); + String mimeType = reference.getMimeType(); + String encoding = reference.getEncoding(); + + if (hdi == null) { + throw new Exception("No hashdata input provided for reference " + signedRefId); + } + if (log.isDebugEnabled()) { + log.debug("Got HashDataInput " + signedRefId + " (" + mimeType + ";" + encoding + ")"); + } + + ReferenceType dsigRef = idSignedRefMap.get(signedRefId); + DigestMethodType dm = dsigRef.getDigestMethod(); + + if (dm == null) { + throw new Exception("Failed to verify digest value for reference " + signedRefId + ": no digest algorithm"); + } + String mdAlg = dm.getAlgorithm(); + if ("http://www.w3.org/2000/09/xmldsig#sha1".equals(mdAlg)) + mdAlg = "SHA-1"; + else if ("http://www.w3.org/2001/04/xmlenc#sha256".equals(mdAlg)) + mdAlg = "SHA-256"; + else if ("http://www.w3.org/2001/04/xmlenc#sha224 ".equals(mdAlg)) + mdAlg = "SHA-224"; + else if ("http://www.w3.org/2001/04/xmldsig-more#sha224 ".equals(mdAlg)) + mdAlg = "SHA-224"; + else if ("http://www.w3.org/2001/04/xmldsig-more#sha384".equals(mdAlg)) + mdAlg = "SHA-384"; + else if ("http://www.w3.org/2001/04/xmlenc#sha512".equals(mdAlg)) + mdAlg = "SHA-512"; + else if ("http://www.w3.org/2001/04/xmldsig-more#md2 ".equals(mdAlg)) + mdAlg = "MD2"; + else if ("http://www.w3.org/2001/04/xmldsig-more#md5".equals(mdAlg)) + mdAlg = "MD5"; + else if ("http://www.w3.org/2001/04/xmlenc#ripemd160 ".equals(mdAlg)) + mdAlg = "RipeMD-160"; + else { + throw new Exception("Failed to verify digest value for reference " + signedRefId + ": unsupported digest algorithm " + mdAlg); + } + MessageDigest md = MessageDigest.getInstance(mdAlg); + byte[] hdiDigest = md.digest(hdi); + if (log.isDebugEnabled()) + log.debug("Comparing digest values... "); + if (!Arrays.equals(hdiDigest, dsigRef.getDigestValue())) { + log.error("digest values differ: " + new String(hdiDigest) + ", " + new String(dsigRef.getDigestValue())); + throw new DigestException("Bad digest value for reference " + signedRefId + ": " + new String(dsigRef.getDigestValue())); + } + hashDataInputs.add(new ByteArrayHashDataInput(hdi, signedRefId, mimeType, encoding)); + } + + gui.showHashDataInputDialog(hashDataInputs, false, this, "ok"); + } +} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java index 743dc7ef..5d199872 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java @@ -18,45 +18,28 @@ package at.gv.egiz.bku.online.applet; import at.gv.egiz.bku.gui.AbstractHelpListener; -import java.awt.Desktop; +import java.applet.AppletContext; import java.net.URL; import java.util.Locale; /** - * Now uses java.awt.Desktop, which deprecates - * the distinction between local and applet help listener - * TODO: integrate in AbstractHelpListener * - * @deprecated - * @author clemens + * @author Clemens Orthacker */ public class AppletHelpListener extends AbstractHelpListener { -// protected AppletContext ctx; - protected Desktop desktop; + protected AppletContext ctx; - public AppletHelpListener(URL helpURL, Locale locale) { + public AppletHelpListener(AppletContext ctx, URL helpURL, Locale locale) { super(helpURL, locale); -// if (ctx == null) { -// throw new RuntimeException("no applet context provided"); -// } -// this.ctx = ctx; - if (Desktop.isDesktopSupported()) { - this.desktop = Desktop.getDesktop(); + if (ctx == null) { + throw new RuntimeException("no applet context provided"); } + this.ctx = ctx; } @Override public void showDocument(URL helpDocument) throws Exception { -// ctx.showDocument(helpDocument, "_blank"); - if (desktop == null) { - log.error("Failed to open default browser: Desktop API not available (libgnome installed?)"); - } else { - if (!desktop.isSupported(Desktop.Action.BROWSE)) { - log.error("Failed to open default browser: The system provides the Desktop API, but does not support the BROWSE action"); - } else { - Desktop.getDesktop().browse(helpDocument.toURI()); - } - } + ctx.showDocument(helpDocument, "_blank"); } } 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 829cc79d..9d640dee 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 @@ -52,6 +52,8 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { public static final String REDIRECT_URL = "RedirectURL"; public static final String REDIRECT_TARGET = "RedirectTarget"; public static final String HASHDATA_DISPLAY_INTERNAL = "internal"; + public static final String HASHDATA_DISPLAY_BROWSER = "browser"; + public static final String HASHDATA_DISPLAY_FRAME = "frame"; /** * STAL WSDL namespace and service name @@ -86,7 +88,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { AppletHelpListener helpListener = null; try { URL helpURL = getURLParameter(HELP_URL); //, getAppletParameter(SESSION_ID)); - helpListener = new AppletHelpListener(helpURL, getLocale()); //getAppletContext(), + helpListener = new AppletHelpListener(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/BrowserHashDataDisplay.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BrowserHashDataDisplay.java new file mode 100644 index 00000000..c30921da --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BrowserHashDataDisplay.java @@ -0,0 +1,52 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.online.applet; + +import java.net.URL; +import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.smccstal.SignRequestHandler; +import at.gv.egiz.stal.signedinfo.ReferenceType; +import java.applet.AppletContext; + +/** + * + * @author Clemens Orthacker + */ +public class BrowserHashDataDisplay extends SignRequestHandler { + + private static final Log log = LogFactory.getLog(BrowserHashDataDisplay.class); + + protected AppletContext ctx; + protected URL hashDataURL; + + public BrowserHashDataDisplay(AppletContext ctx, URL hashDataURL) { + this.ctx = ctx; + this.hashDataURL = hashDataURL; + } + + @Override + public void displayHashDataInputs(List signedReferences) throws Exception { + //TODO pass reference Id's to servlet (TODO servlet) + log.debug("displaying hashdata inputs at " + hashDataURL); + ctx.showDocument(hashDataURL, "_blank"); + } +} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java deleted file mode 100644 index e4567a6c..00000000 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package at.gv.egiz.bku.online.applet; - -import java.net.URL; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.bku.smccstal.SignRequestHandler; -import at.gv.egiz.stal.signedinfo.ReferenceType; -import java.awt.Desktop; - -/** - * - * @author Clemens Orthacker - */ -public class ExternalDisplaySignRequestHandler extends SignRequestHandler { - - private static final Log log = LogFactory.getLog(ExternalDisplaySignRequestHandler.class); - -// AppletContext ctx; - protected URL hashDataURL; - protected Desktop desktop; - - public ExternalDisplaySignRequestHandler(URL hashDataURL) { -// this.ctx = ctx; - this.hashDataURL = hashDataURL; - if (Desktop.isDesktopSupported()) { - desktop = Desktop.getDesktop(); - } - } - - @Override - public void displayHashDataInputs(List signedReferences) throws Exception { - //TODO pass reference Id's to servlet (TODO servlet) - log.debug("displaying hashdata inputs at " + hashDataURL); -// ctx.showDocument(hashDataURL, "_blank"); - if (desktop == null) { - log.error("Failed to open default browser: Desktop API not available (libgnome installed?)"); - } else { - if (!desktop.isSupported(Desktop.Action.BROWSE)) { - log.error("Failed to open default browser: The system provides the Desktop API, but does not support the BROWSE action"); - } else { - Desktop.getDesktop().browse(hashDataURL.toURI()); - } - } - } - -} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/JDialogHashDataDisplay.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/JDialogHashDataDisplay.java new file mode 100644 index 00000000..1f0eda90 --- /dev/null +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/JDialogHashDataDisplay.java @@ -0,0 +1,221 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.online.applet; + +import at.gv.egiz.bku.smccstal.SignRequestHandler; +import at.gv.egiz.stal.HashDataInput; +import at.gv.egiz.stal.impl.ByteArrayHashDataInput; +import at.gv.egiz.stal.service.GetHashDataInputFault; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.types.GetHashDataInputResponseType; +import at.gv.egiz.stal.service.types.GetHashDataInputType; +import at.gv.egiz.stal.signedinfo.ReferenceType; +import java.awt.Dimension; +import java.security.DigestException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker + */ +public class JDialogHashDataDisplay extends SignRequestHandler { + + private static final Log log = LogFactory.getLog(JDialogHashDataDisplay.class); + protected STALPortType stalPort; + protected String sessId; +// protected HashDataViewer viewer; + + public JDialogHashDataDisplay(STALPortType stalPort, String sessId, Dimension viewerSize, Locale locale) { + if (stalPort == null || sessId == null) { + throw new NullPointerException("STAL port must not be null"); + } + this.sessId = sessId; + this.stalPort = stalPort; +// this.viewer = new HashDataViewer(viewerSize, locale); + } + + @Override + public void displayHashDataInputs(List signedReferences) throws DigestException, Exception { + + List hdi = getHashDataInput(signedReferences); + final List verifiedHashDataInputs = verifyHashDataInput(signedReferences, hdi); + + if (verifiedHashDataInputs.size() > 1) { + gui.showHashDataInputDialog(verifiedHashDataInputs, false, this, "ok"); + } else if (verifiedHashDataInputs.size() == 1) { + gui.showHashDataInputDialog(verifiedHashDataInputs, true, this, "ok"); +// SwingUtilities.invokeLater(new Runnable() { +// +// @Override +// public void run() { +// viewer.displayHashData(verifiedHashDataInputs.get(0)); +// } +// }); + + } else { + log.error("No hashdata input to display"); + } + + } + + /** + * Get all hashdata inputs that contain an ID attribute and no Type attribute. + * @param signedReferences + * @return + * @throws at.gv.egiz.stal.service.GetHashDataInputFault + */ + private List getHashDataInput(List signedReferences) throws GetHashDataInputFault, Exception { + GetHashDataInputType request = new GetHashDataInputType(); + request.setSessionId(sessId); + +// HashMap idSignedRefMap = new HashMap(); + for (ReferenceType signedRef : signedReferences) { + //don't get Manifest, QualifyingProperties, ... + if (signedRef.getType() == null) { + String signedRefId = signedRef.getId(); + if (signedRefId != null) { + if (log.isTraceEnabled()) { + log.trace("requesting hashdata input for reference " + signedRefId); + } +// idSignedRefMap.put(signedRefId, signedRef); + GetHashDataInputType.Reference ref = new GetHashDataInputType.Reference(); + ref.setID(signedRefId); + request.getReference().add(ref); + + } else { + throw new Exception("Cannot resolve HashDataInput for reference without Id attribute"); + } + } + } + + if (log.isDebugEnabled()) { + log.debug("WebService call GetHashDataInput for " + request.getReference().size() + " references in session " + sessId); + } + GetHashDataInputResponseType response = stalPort.getHashDataInput(request); + return response.getReference(); + } + + /** + * Verifies all signed references and returns STAL HashDataInputs + * @param signedReferences + * @param hashDataInputs + * @return + * @throws java.security.DigestException + * @throws java.security.NoSuchAlgorithmException + * @throws Exception if no hashdata input is provided for a signed reference + */ + private List verifyHashDataInput(List signedReferences, List hashDataInputs) throws DigestException, NoSuchAlgorithmException, Exception { + + ArrayList verifiedHashDataInputs = new ArrayList(); + + //hashdata inputs returned from service +// HashMap idRefMap = new HashMap(); +// for (GetHashDataInputResponseType.Reference hashDataInput : hashDataInputs) { +// String id = hashDataInput.getID(); +// byte[] hdi = hashDataInput.getValue(); +// if (hdi == null) { +// throw new Exception("Did not receive hashdata input for reference " + id); +// } +// idRefMap.put(id, hashDataInput); +// } + + for (ReferenceType signedRef : signedReferences) { + if (signedRef.getType() == null) { + log.info("Verifying digest for signed reference " + signedRef.getId()); + + String signedRefId = signedRef.getId(); + byte[] signedDigest = signedRef.getDigestValue(); + String signedDigestAlg = null; + if (signedRef.getDigestMethod() != null) { + signedDigestAlg = signedRef.getDigestMethod().getAlgorithm(); + } else { + throw new NoSuchAlgorithmException("Failed to verify digest value for reference " + signedRefId + ": no digest algorithm"); + } + + GetHashDataInputResponseType.Reference hashDataInput = null; //idRefMap.get(signedRefId); + for (GetHashDataInputResponseType.Reference hdi : hashDataInputs) { + if (signedRefId.equals(hdi.getID())) { + hashDataInput = hdi; + } + } + if (hashDataInput == null) { + throw new Exception("No hashdata input for reference " + signedRefId + " returned by service"); + } + + byte[] hdi = hashDataInput.getValue(); + String mimeType = hashDataInput.getMimeType(); + String encoding = hashDataInput.getEncoding(); + + if (hdi == null) { + throw new Exception("No hashdata input for reference " + signedRefId + " provided by service"); + } + if (log.isDebugEnabled()) { + log.debug("Got HashDataInput " + signedRefId + " (" + mimeType + ";" + encoding + ")"); + } + + byte[] hashDataInputDigest = digest(hdi, signedDigestAlg); + + if (log.isDebugEnabled()) { + log.debug("Comparing digest values... "); + } + log.warn("DISABLED DIGEST VERIFICATION FOR DEBUGGING"); +// if (!Arrays.equals(hashDataInputDigest, signedDigest)) { +// log.error("Bad digest value for reference " + signedRefId); +// throw new DigestException("Bad digest value for reference " + signedRefId); +// } + + verifiedHashDataInputs.add(new ByteArrayHashDataInput(hdi, signedRefId, mimeType, encoding)); + } + } + + return verifiedHashDataInputs; + } + + //TODO + private byte[] digest(byte[] hashDataInput, String mdAlg) throws NoSuchAlgorithmException { + if ("http://www.w3.org/2000/09/xmldsig#sha1".equals(mdAlg)) { + mdAlg = "SHA-1"; + } else if ("http://www.w3.org/2001/04/xmlenc#sha256".equals(mdAlg)) { + mdAlg = "SHA-256"; + } else if ("http://www.w3.org/2001/04/xmlenc#sha224".equals(mdAlg)) { + mdAlg = "SHA-224"; + } else if ("http://www.w3.org/2001/04/xmldsig-more#sha224".equals(mdAlg)) { + mdAlg = "SHA-224"; + } else if ("http://www.w3.org/2001/04/xmldsig-more#sha384".equals(mdAlg)) { + mdAlg = "SHA-384"; + } else if ("http://www.w3.org/2001/04/xmlenc#sha512".equals(mdAlg)) { + mdAlg = "SHA-512"; + } else if ("http://www.w3.org/2001/04/xmldsig-more#md2 ".equals(mdAlg)) { + mdAlg = "MD2"; + } else if ("http://www.w3.org/2001/04/xmldsig-more#md5".equals(mdAlg)) { + mdAlg = "MD5"; + } else if ("http://www.w3.org/2001/04/xmlenc#ripemd160 ".equals(mdAlg)) { + mdAlg = "RipeMD-160"; + } else { + throw new NoSuchAlgorithmException("Failed to verify digest value: unsupported digest algorithm " + mdAlg); + } + + MessageDigest md = MessageDigest.getInstance(mdAlg); + return md.digest(hashDataInput); + } +} diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java deleted file mode 100644 index 014065f2..00000000 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package at.gv.egiz.bku.online.applet; - -import java.security.DigestException; -import java.security.MessageDigest; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.bku.smccstal.SignRequestHandler; -import at.gv.egiz.stal.HashDataInput; -import at.gv.egiz.stal.impl.ByteArrayHashDataInput; -import at.gv.egiz.stal.service.STALPortType; -import at.gv.egiz.stal.service.types.GetHashDataInputResponseType; -import at.gv.egiz.stal.service.types.GetHashDataInputType; -import at.gv.egiz.stal.signedinfo.DigestMethodType; -import at.gv.egiz.stal.signedinfo.ReferenceType; - -/** - * @author clemens - */ -public class WebServiceSignRequestHandler extends SignRequestHandler { - - private static final Log log = LogFactory.getLog(WebServiceSignRequestHandler.class); - STALPortType stalPort; - String sessId; - - public WebServiceSignRequestHandler(STALPortType stalPort, String sessId) { - if (stalPort == null || sessId == null) { - throw new NullPointerException("STAL port must not be null"); - } - this.sessId = sessId; - this.stalPort = stalPort; - } - - @Override - public void displayHashDataInputs(List signedReferences) throws Exception { - - GetHashDataInputType request = new GetHashDataInputType(); - request.setSessionId(sessId); - - HashMap idSignedRefMap = new HashMap(); - for (ReferenceType signedRef : signedReferences) { - //don't get Manifest, QualifyingProperties, ... - if (signedRef.getType() == null) { - String signedRefId = signedRef.getId(); - if (signedRefId != null) { - if (log.isTraceEnabled()) { - log.trace("requesting hashdata input for reference " + signedRefId); - } - idSignedRefMap.put(signedRefId, signedRef); - GetHashDataInputType.Reference ref = new GetHashDataInputType.Reference(); - ref.setID(signedRefId); - request.getReference().add(ref); - - } else { - throw new Exception("Cannot resolve HashDataInput for reference without Id attribute"); - } - } - } - - if (log.isDebugEnabled()) { - log.debug("Calling GetHashDataInput for " + request.getReference().size() + " references in session " + sessId); - } - GetHashDataInputResponseType response = stalPort.getHashDataInput(request); - ArrayList hashDataInputs = new ArrayList(); - - //hashdata inputs returned from service - HashMap idRefMap = new HashMap(); - for (GetHashDataInputResponseType.Reference reference : response.getReference()) { - String id = reference.getID(); - byte[] hdi = reference.getValue(); - if (hdi == null) { - throw new Exception("Did not receive hashdata input for reference " + id); - } - idRefMap.put(id, reference); - } - - for (String signedRefId : idSignedRefMap.keySet()) { - log.info("validating hashdata input for reference " + signedRefId); - - GetHashDataInputResponseType.Reference reference = idRefMap.get(signedRefId); - if (reference == null) { - throw new Exception("No hashdata input for reference " + signedRefId + " returned by service"); - } - -// } -// -// for (GetHashDataInputResponseType.Reference reference : response.getReference()) { -// -// String id = reference.getID(); - byte[] hdi = reference.getValue(); - String mimeType = reference.getMimeType(); - String encoding = reference.getEncoding(); - - if (hdi == null) { - throw new Exception("No hashdata input provided for reference " + signedRefId); - } - if (log.isDebugEnabled()) { - log.debug("Got HashDataInput " + signedRefId + " (" + mimeType + ";" + encoding + ")"); - } - - ReferenceType dsigRef = idSignedRefMap.get(signedRefId); - DigestMethodType dm = dsigRef.getDigestMethod(); - - if (dm == null) { - throw new Exception("Failed to verify digest value for reference " + signedRefId + ": no digest algorithm"); - } - String mdAlg = dm.getAlgorithm(); - if ("http://www.w3.org/2000/09/xmldsig#sha1".equals(mdAlg)) - mdAlg = "SHA-1"; - else if ("http://www.w3.org/2001/04/xmlenc#sha256".equals(mdAlg)) - mdAlg = "SHA-256"; - else if ("http://www.w3.org/2001/04/xmlenc#sha224 ".equals(mdAlg)) - mdAlg = "SHA-224"; - else if ("http://www.w3.org/2001/04/xmldsig-more#sha224 ".equals(mdAlg)) - mdAlg = "SHA-224"; - else if ("http://www.w3.org/2001/04/xmldsig-more#sha384".equals(mdAlg)) - mdAlg = "SHA-384"; - else if ("http://www.w3.org/2001/04/xmlenc#sha512".equals(mdAlg)) - mdAlg = "SHA-512"; - else if ("http://www.w3.org/2001/04/xmldsig-more#md2 ".equals(mdAlg)) - mdAlg = "MD2"; - else if ("http://www.w3.org/2001/04/xmldsig-more#md5".equals(mdAlg)) - mdAlg = "MD5"; - else if ("http://www.w3.org/2001/04/xmlenc#ripemd160 ".equals(mdAlg)) - mdAlg = "RipeMD-160"; - else { - throw new Exception("Failed to verify digest value for reference " + signedRefId + ": unsupported digest algorithm " + mdAlg); - } - MessageDigest md = MessageDigest.getInstance(mdAlg); - byte[] hdiDigest = md.digest(hdi); - if (log.isDebugEnabled()) - log.debug("Comparing digest values... "); - if (!Arrays.equals(hdiDigest, dsigRef.getDigestValue())) { - log.error("digest values differ: " + new String(hdiDigest) + ", " + new String(dsigRef.getDigestValue())); - throw new DigestException("Bad digest value for reference " + signedRefId + ": " + new String(dsigRef.getDigestValue())); - } - hashDataInputs.add(new ByteArrayHashDataInput(hdi, signedRefId, mimeType, encoding)); - } - - gui.showHashDataInputDialog(hashDataInputs, this, "ok"); - } -} diff --git a/BKUApplet/src/main/resources/simplelog.properties b/BKUApplet/src/main/resources/simplelog.properties index d62508cf..51be76a8 100644 --- a/BKUApplet/src/main/resources/simplelog.properties +++ b/BKUApplet/src/main/resources/simplelog.properties @@ -15,7 +15,7 @@ # Logging detail level, # Must be one of ("trace", "debug", "info", "warn", "error", or "fatal"). -org.apache.commons.logging.simplelog.defaultlog=debug +org.apache.commons.logging.simplelog.defaultlog=trace # Logs the Log instance used org.apache.commons.logging.simplelog.showlogname=true #Logs the class name with package(or Path) diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html index 5aec1998..1ba88e47 100644 --- a/BKUApplet/src/test/resources/appletTest.html +++ b/BKUApplet/src/test/resources/appletTest.html @@ -20,11 +20,11 @@ - + - + diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java index d96d22c8..d661c71a 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java @@ -814,7 +814,7 @@ public class BKUGUI implements BKUGUIFacade { } @Override - public void showHashDataInputDialog(final List signedReferences, final ActionListener okListener, final String okCommand) { + public void showHashDataInputDialog(final List signedReferences, boolean standalone, final ActionListener okListener, final String okCommand) { if (signedReferences == null) { showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {"No SignedReferences provided"}, okListener, okCommand); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index ad489c2e..38638b5d 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -57,6 +57,7 @@ public interface BKUGUIFacade { public static final String WINDOWTITLE_SAVE = "windowtitle.save"; public static final String WINDOWTITLE_SAVEDIR = "windowtitle.savedir"; public static final String WINDOWTITLE_OVERWRITE = "windowtitle.overwrite"; + public static final String WINDOWTITLE_VIEWER = "windowtitle.viewer"; public static final String MESSAGE_WAIT = "message.wait"; public static final String MESSAGE_INSERTCARD = "message.insertcard"; public static final String MESSAGE_ENTERPIN = "message.enterpin"; @@ -77,12 +78,14 @@ public interface BKUGUIFacade { public static final String HELP_RETRY = "help.retry"; public static final String HELP_HASHDATA = "help.hashdata"; public static final String HELP_HASHDATALIST = "help.hashdatalist"; + public static final String HELP_HASHDATAVIEWER = "help.hashdataviewer"; public static final String BUTTON_OK = "button.ok"; public static final String BUTTON_CANCEL = "button.cancel"; public static final String BUTTON_BACK = "button.back"; public static final String BUTTON_SIGN = "button.sign"; public static final String BUTTON_SAVE = "button.save"; + public static final String BUTTON_CLOSE = "button.close"; public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix"; @@ -116,7 +119,7 @@ public interface BKUGUIFacade { public char[] getPin(); - public void showHashDataInputDialog(List signedReferences, ActionListener okListener, String actionCommand); + public void showHashDataInputDialog(List signedReferences, boolean standalone, ActionListener okListener, String actionCommand); // public void showPlainTextHashDataInputDialog(String text, ActionListener saveListener, String saveCommand, ActionListener cancelListener, String cancelCommand); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java new file mode 100644 index 00000000..3db06e19 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java @@ -0,0 +1,260 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.gui; + +import at.gv.egiz.stal.HashDataInput; +import java.awt.Component; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.io.InputStreamReader; +import java.io.Reader; +import java.text.MessageFormat; +import java.util.List; +import java.util.ResourceBundle; +import javax.swing.GroupLayout; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JEditorPane; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.LayoutStyle; +import javax.swing.text.Document; +import javax.swing.text.EditorKit; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker + */ +public class HashDataViewer extends JDialog + implements ActionListener, WindowListener { + + public static final String PLAINTEXT_FONT = "Monospaced"; + + protected static final Log log = LogFactory.getLog(HashDataViewer.class); + private static HashDataViewer dialog; + + public static void showDialog(Component frameComp, List signedReferences, ResourceBundle messages, ActionListener saveListener, String saveCommand, HelpMouseListener helpListener) { + + log.info("******************* SHOW HASHDATA DIALOG"); + + Frame frame = JOptionPane.getFrameForComponent(frameComp); + + dialog = new HashDataViewer(frame, signedReferences.get(0), messages, saveListener, saveCommand, helpListener); + dialog.addWindowListener(dialog); + dialog.setVisible(true); + + } + + private HashDataViewer(Frame frame, HashDataInput hashData, ResourceBundle messages, ActionListener saveListener, String saveCommand, HelpMouseListener helpListener) { + super(frame, messages.getString(BKUGUIFacade.WINDOWTITLE_VIEWER), true); + + JPanel viewerPanel = createViewerPanel(messages, hashData, helpListener); + JPanel buttonPanel = createButtonPanel(messages, saveListener, saveCommand); + + + Container contentPane = getContentPane(); + contentPane.setPreferredSize(new Dimension(400, 300)); + + GroupLayout mainLayout = new GroupLayout(contentPane); + contentPane.setLayout(mainLayout); + + mainLayout.setHorizontalGroup( + mainLayout.createSequentialGroup() + .addContainerGap() + .addGroup( + mainLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(viewerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()); + mainLayout.setVerticalGroup( + mainLayout.createSequentialGroup() + .addContainerGap() + .addComponent(viewerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addContainerGap()); + + pack(); + setLocationRelativeTo(frame); + } + + private JPanel createViewerPanel(ResourceBundle messages, HashDataInput hashData, HelpMouseListener helpListener) { + String mimeType = hashData.getMimeType(); + String encoding = hashData.getEncoding(); + + log.debug("display hashdata: " + mimeType + ";" + encoding); + + if (mimeType == null) { + mimeType = "text/plain"; + } + if (encoding == null) { + encoding = "UTF-8"; + } + + JEditorPane viewer = new JEditorPane(); + viewer.setEditable(false); + viewer.setContentType(mimeType); + if ("text/plain".equals(mimeType)) { + viewer.setFont(new Font(PLAINTEXT_FONT, viewer.getFont().getStyle(), viewer.getFont().getSize())); + } + + EditorKit editorKit = viewer.getEditorKit(); + Document document = editorKit.createDefaultDocument(); + + Reader reader; + try { + reader = new InputStreamReader(hashData.getHashDataInput(), encoding); + viewer.read(reader, document); + } catch (Exception ex) { + String p = messages.getString(BKUGUIFacade.ERR_DISPLAY_HASHDATA); + viewer.setText(MessageFormat.format(p, ex.getMessage())); + } + + JScrollPane scrollPane = new JScrollPane(viewer); +// scrollPane.setPreferredSize(new Dimension(400, 300)); + scrollPane.setPreferredSize(viewer.getPreferredSize()); + scrollPane.setAlignmentX(LEFT_ALIGNMENT); + + JLabel viewerTitle = new JLabel(); + viewerTitle.setText(messages.getString(BKUGUIFacade.TITLE_HASHDATA)); + viewerTitle.setFont(viewerTitle.getFont().deriveFont(viewerTitle.getFont().getStyle() | java.awt.Font.BOLD)); + viewerTitle.setLabelFor(viewer); + + JLabel helpLabel = new JLabel(); + helpListener.setHelpTopic(BKUGUIFacade.HELP_HASHDATAVIEWER); + helpLabel.setIcon(new ImageIcon(getClass().getResource(BKUGUIFacade.HELP_IMG))); + helpLabel.addMouseListener(helpListener); + helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + + JPanel viewerPanel = new JPanel(); + GroupLayout viewerPanelLayout = new GroupLayout(viewerPanel); + viewerPanel.setLayout(viewerPanelLayout); + + viewerPanelLayout.setHorizontalGroup( + viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(viewerPanelLayout.createSequentialGroup() + .addComponent(viewerTitle) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel)) + .addComponent(scrollPane)); //, 0, 0, Short.MAX_VALUE)); + + viewerPanelLayout.setVerticalGroup( + viewerPanelLayout.createSequentialGroup() + .addGroup(viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(viewerTitle) + .addComponent(helpLabel)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(scrollPane)); //, 0, 0, Short.MAX_VALUE)); + +// viewerPanel.setLayout(new BoxLayout(viewerPanel, BoxLayout.PAGE_AXIS)); +// JLabel title = new JLabel(messages.getString(BKUGUIFacade.TITLE_HASHDATA)); +// title.setLabelFor(viewer); +// viewerPanel.add(title); +// viewerPanel.add(Box.createRigidArea(new Dimension(0, 5))); +// viewerPanel.add(scrollPane); +// viewerPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); + + return viewerPanel; + } + + private JPanel createButtonPanel(ResourceBundle messages, ActionListener saveListener, String saveCommand) { + JButton closeButton = new JButton(); + closeButton.setText(messages.getString(BKUGUIFacade.BUTTON_CLOSE)); + closeButton.addActionListener(this); + + JButton saveButton = new JButton(); + saveButton.setText(messages.getString(BKUGUIFacade.BUTTON_SAVE)); + saveButton.setActionCommand(saveCommand); + saveButton.addActionListener(saveListener); + + int buttonSize = closeButton.getPreferredSize().width; + if (saveButton.getPreferredSize().width > buttonSize) { + buttonSize = saveButton.getPreferredSize().width; + } + + JPanel buttonPanel = new JPanel(); + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(closeButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(saveButton).addComponent(closeButton)); + + return buttonPanel; + } + + @Override + public void actionPerformed(ActionEvent e) { +// if ("close".equals(e.getActionCommand())) { + HashDataViewer.dialog.setVisible(false); +// HashDataViewer.dialog.dispose(); + } + + @Override + public void windowOpened(WindowEvent e) { + log.debug("WINDOW OPENED"); + } + + @Override + public void windowClosing(WindowEvent e) { + log.debug("WINDOW CLOSING"); + } + + @Override + public void windowClosed(WindowEvent e) { + log.debug("WINDOW CLOSED"); + } + + @Override + public void windowIconified(WindowEvent e) { + log.debug("WINDOW ICONIFIED"); + } + + @Override + public void windowDeiconified(WindowEvent e) { + } + + @Override + public void windowActivated(WindowEvent e) { + log.debug("WINDOW ACTIVATED"); + } + + @Override + public void windowDeactivated(WindowEvent e) { + log.debug("WINDOW DEACTIVATED"); + } + + + + + + + +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java index f2a8466b..583dae0f 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java @@ -882,14 +882,25 @@ public class SimpleGUI implements BKUGUIFacade { } @Override - public void showHashDataInputDialog(final List signedReferences, final ActionListener okListener, final String okCommand) { + public void showHashDataInputDialog(final List signedReferences, boolean standalone, final ActionListener okListener, final String okCommand) { if (signedReferences == null) { showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {"No SignedReferences provided"}, okListener, okCommand); } if (signedReferences.size() == 1) { - + + if (standalone) { + ActionListener saveHashDataListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + showSaveHashDataInputDialog(signedReferences, okListener, okCommand); + } + }; + showHashDataViewer(signedReferences, saveHashDataListener, "save"); + + } else { if ("text/plain".equals(signedReferences.get(0).getMimeType())) { ActionListener saveHashDataListener = new ActionListener() { @@ -910,7 +921,7 @@ public class SimpleGUI implements BKUGUIFacade { } else { showSaveHashDataInputDialog(signedReferences, okListener, okCommand); } - + } } else { final HashDataTableModel tableModel = new HashDataTableModel(signedReferences); @@ -926,6 +937,27 @@ public class SimpleGUI implements BKUGUIFacade { } } + /** + * TODO + * @param hashDataText + * @param saveListener + * @param saveCommand + */ + private void showHashDataViewer(final List signedReferences, final ActionListener saveListener, final String saveCommand) { + log.debug("scheduling plaintext hashdatainput dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show plaintext hashdatainput dialog"); + + HashDataViewer.showDialog(contentPane, signedReferences, messages, saveListener, saveCommand, helpListener); + } + }); + } + private void showPlainTextHashDataInputDialog(final String hashDataText, final ActionListener saveListener, final String saveCommand, final ActionListener cancelListener, final String cancelCommand) { log.debug("scheduling plaintext hashdatainput dialog"); diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index 2dc03491..c47242b2 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -25,6 +25,7 @@ title.hashdata=Signaturdaten windowtitle.save=Signaturdaten speichern windowtitle.savedir=Signaturdaten in Verzeichnis speichern windowtitle.overwrite=Datei \u00FCberschreiben? +windowtitle.viewer=Signaturedaten message.wait=Bitte warten... message.insertcard=Bitte die B\u00FCrgerkarte in den Kartenleser stecken message.enterpin={0} eingeben @@ -40,6 +41,7 @@ button.cancel=Abbrechen button.back=Zur\u00FCck button.sign=Signieren button.save=Speichern... +button.close=Schlie\u00DFen mimetype.desc.xml=XML-Dateien (.xml) mimetype.desc.html=HTML-Dateien (.html, .htm) mimetype.desc.xhtml=XHTML-Dateien (.xhtml) diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties index 3b8ac1bc..c7cc9084 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties @@ -25,6 +25,7 @@ title.hashdata=Signature data windowtitle.save=Save signature data windowtitle.savedir=Save signature data to directory windowtitle.overwrite=Overwrite file? +windowtitle.viewer=Signature data message.wait=Please wait... message.insertcard=Please insert your citizen-card into the reader message.enterpin=Enter {0} @@ -40,6 +41,7 @@ button.cancel=Cancel button.back=Back button.sign=Sign button.save=Save... +button.close=Close mimetype.desc.xml=XML-files (.xml) mimetype.desc.html=HTML-files (.html, .htm) mimetype.desc.xhtml=XHTML-files (.xhtml) diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java index 2251a474..e32c9c3d 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java @@ -25,7 +25,6 @@ import java.util.Locale; /** * - * @deprecated see AppletHelpListener * @author Clemens Orthacker */ public class LocalHelpListener extends AbstractHelpListener { diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java index 19a56502..19e6a657 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java @@ -53,7 +53,7 @@ public class LocalSignRequestHandler extends SignRequestHandler { */ @SuppressWarnings("unchecked") @Override - public STALResponse handleRequest(STALRequest request) { + public STALResponse handleRequest(STALRequest request) throws InterruptedException { if (request instanceof SignRequest) { SignRequest signReq = (SignRequest) request; hashDataInputs = signReq.getHashDataInput(); @@ -109,7 +109,7 @@ public class LocalSignRequestHandler extends SignRequestHandler { log.error("dsig:SignedInfo does not contain a data reference"); throw new Exception("dsig:SignedInfo does not contain a data reference"); } - gui.showHashDataInputDialog(selectedHashDataInputs, this, "ok"); + gui.showHashDataInputDialog(selectedHashDataInputs, false, this, "ok"); } private ByteArrayHashDataInput getByteArrayHashDataInput(HashDataInput hashDataInput) throws IOException { diff --git a/BKUOnline/src/main/webapp/HTTP-ohne.html b/BKUOnline/src/main/webapp/HTTP-ohne.html index 47c059f2..112a1d92 100644 --- a/BKUOnline/src/main/webapp/HTTP-ohne.html +++ b/BKUOnline/src/main/webapp/HTTP-ohne.html @@ -99,8 +99,9 @@ legend {

- external - internal + Frame + Browser + Applet

\ No newline at end of file diff --git a/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java b/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java deleted file mode 100644 index 01d207d2..00000000 --- a/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java +++ /dev/null @@ -1,67 +0,0 @@ -package at.gv.egiz.stal.util; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.bku.utils.StreamUtil; -import at.gv.egiz.stal.HashDataInput; - -/** - * Enables multiple read requests. - * @deprecated use at.gv.egiz.stal.impl.ByteArrayHashDataInput - */ -public class HashDataInputProxy implements HashDataInput { - - private static Log log = LogFactory.getLog(HashDataInputProxy.class); - - private HashDataInput delegate; - private byte[] hashInput; - - /** - * - * @param delegate - * != null - */ - public HashDataInputProxy(HashDataInput delegate) { - if (delegate == null) { - throw new NullPointerException("Constructor argument must not be null"); - } - this.delegate = delegate; - } - - @Override - public String getEncoding() { - return delegate.getEncoding(); - } - - @Override - public InputStream getHashDataInput() { - if (hashInput == null) { - ByteArrayOutputStream os = new ByteArrayOutputStream(); - try { - StreamUtil.copyStream(delegate.getHashDataInput(), os); - hashInput = os.toByteArray(); - } catch (IOException e) { - log.error("Cannot access hashdatainput stream", e); - hashInput = new byte[0]; - } - } - return new ByteArrayInputStream(hashInput); - } - - @Override - public String getMimeType() { - return delegate.getMimeType(); - } - - @Override - public String getReferenceId() { - return delegate.getReferenceId(); - } - -} diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/HashDataInputDisplay.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/HashDataInputDisplay.java index f79a2027..59700d4a 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/HashDataInputDisplay.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/HashDataInputDisplay.java @@ -1,6 +1,18 @@ /* - * To change this template, choose Tools | Templates - * and open the template in the editor. + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package at.gv.egiz.bku.smccstal; @@ -14,7 +26,11 @@ import java.util.List; */ public interface HashDataInputDisplay { + /** + * TODO: (see AbstractHelpListener) + * + * * Displays the hashdata inputs for all provided dsig:SignedReferences. * Implementations may verify the digest value if necessary. * (LocalSignRequestHandler operates on DataObjectHashDataInput, diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java index 6c30a68a..77ee45b6 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java @@ -192,7 +192,7 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen - class STALPinProvider implements PINProvider, ActionListener { + class STALPinProvider implements PINProvider { protected SignedInfoType signedInfo; protected List hashDataInputs; @@ -230,10 +230,10 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen displayHashDataInputs(signedInfo.getReference()); } catch (DigestException ex) { log.error("Bad digest value: " + ex.getMessage()); - gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH, new Object[] {ex.getMessage()}); + gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH, new Object[] {ex.getMessage()}, SignRequestHandler.this, "error"); } catch (Exception ex) { log.error("Could not display hashdata inputs: " + ex.getMessage()); - gui.showErrorDialog(BKUGUIFacade.ERR_DISPLAY_HASHDATA, new Object[] {ex.getMessage()}, SignRequestHandler.this, "ok"); + gui.showErrorDialog(BKUGUIFacade.ERR_DISPLAY_HASHDATA, new Object[] {ex.getMessage()}, SignRequestHandler.this, "error"); } // OLD HASHDATA DISPLAY (in applet), @@ -261,13 +261,15 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen return new String(gui.getPin()); } else if (actionCommand.equals("ok")) { showSignaturePINDialog(spec, retries); + } else if (actionCommand.equals("error")) { + return null; } } while (true); } - @Override - public void actionPerformed(ActionEvent e) { - throw new UnsupportedOperationException("Not supported yet."); - } +// @Override +// public void actionPerformed(ActionEvent e) { +// throw new UnsupportedOperationException("Not supported yet."); +// } } } -- cgit v1.2.3 From fef61ddc786960015c6fc416d4ad2d5d0f2048d1 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 13 Nov 2008 20:56:23 +0000 Subject: bugfix openwindow blocked bugfix helpTopic always hashdataviewer git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@168 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/online/applet/BKUApplet.java | 2 +- .../bku/online/applet/DefaultHelpListener.java | 38 +-- .../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 1 + .../java/at/gv/egiz/bku/gui/HashDataViewer.java | 288 +++++++++++++++++ .../java/at/gv/egiz/bku/gui/HelpMouseListener.java | 10 +- .../main/java/at/gv/egiz/bku/gui/HelpViewer.java | 211 ++++++++++++ .../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 3 +- .../main/java/at/gv/egiz/bku/gui/ViewerDialog.java | 357 --------------------- .../at/gv/egiz/bku/gui/Messages.properties | 1 + .../at/gv/egiz/bku/gui/Messages_en.properties | 1 + .../gv/egiz/bku/local/gui/LocalHelpListener.java | 2 +- .../at/gv/egiz/bku/local/stal/BKUGuiProxy.java | 18 +- 12 files changed, 531 insertions(+), 401 deletions(-) create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java delete mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerDialog.java (limited to 'BKUApplet') 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 */ 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); } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index 2daf3300..c7032f90 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -38,6 +38,7 @@ public interface BKUGUIFacade { public static final String ERR_CARD_LOCKED = "error.card.locked"; public static final String ERR_CARD_NOTACTIVATED = "error.card.notactivated"; public static final String ERR_VIEWER = "error.viewer"; + public static final String ERR_EXTERNAL_LINK = "error.external.link"; public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages"; public static final String DEFAULT_BACKGROUND = "/images/BackgroundChipperling.png"; diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java new file mode 100644 index 00000000..8883098a --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java @@ -0,0 +1,288 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.gui; + +import at.gv.egiz.stal.HashDataInput; +import java.awt.Component; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.nio.charset.Charset; +import java.text.MessageFormat; +import java.util.List; +import java.util.ResourceBundle; +import javax.swing.GroupLayout; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JEditorPane; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.LayoutStyle; +import javax.swing.text.Document; +import javax.swing.text.EditorKit; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker + */ +public class HashDataViewer extends JDialog + implements ActionListener { + + public static final String PLAINTEXT_FONT = "Monospaced"; + protected static final Log log = LogFactory.getLog(HashDataViewer.class); + + private static HashDataViewer dialog; + + protected ResourceBundle messages; + + /** + * + * @param signedReferences currently, only one hashdata input (the first in the list) is displayed + */ + public static void showHashDataInput(List hashDataInputs, + ResourceBundle messages, + ActionListener saveListener, + String saveCommand, + ActionListener helpListener) { + showHashDataInput(null, hashDataInputs, messages, saveListener, saveCommand, helpListener); + } + + /** + * + * @param frameComp owner + */ + public static void showHashDataInput(Component frameComp, + List hashDataInputs, + ResourceBundle messages, + ActionListener saveListener, + String saveCommand, + ActionListener helpListener) { + + Frame frame = null; + if (frameComp != null) { + JOptionPane.getFrameForComponent(frameComp); + } + dialog = new HashDataViewer(frame, + messages, + hashDataInputs, + saveListener, + saveCommand, + helpListener); + dialog.setVisible(true); + } + + private HashDataViewer(Frame frame, + ResourceBundle messages, + List hashDataInputs, + ActionListener saveListener, + String saveCommand, + ActionListener helpListener) { + super(frame, messages.getString(BKUGUIFacade.WINDOWTITLE_VIEWER), true); + this.messages = messages; + + HashDataInput hashData = hashDataInputs.get(0); + + Charset cs; + if (hashData.getEncoding() == null) { + cs = Charset.forName("UTF-8"); + } else { + try { + cs = Charset.forName(hashData.getEncoding()); + } catch (Exception ex) { + log.debug("charset " + hashData.getEncoding() + " not supported, assuming UTF-8: " + ex.getMessage()); + cs = Charset.forName("UTF-8"); + } + } + + + InputStreamReader isr = new InputStreamReader(hashData.getHashDataInput(), cs); + Reader content = new BufferedReader(isr); + + JPanel hashDataPanel = createViewerPanel( + messages.getString(BKUGUIFacade.MESSAGE_HASHDATA), + content, + hashData.getMimeType(), + helpListener); + JPanel buttonPanel = createButtonPanel(saveListener, saveCommand); + initContentPane(new Dimension(600, 400), hashDataPanel, buttonPanel); + + pack(); + if (frame != null) { + setLocationRelativeTo(frame); + } else { + setLocationByPlatform(true); + } + } + + private void initContentPane(Dimension preferredSize, JPanel viewerPanel, JPanel buttonPanel) { + Container contentPane = getContentPane(); + contentPane.setPreferredSize(preferredSize); + + GroupLayout mainLayout = new GroupLayout(contentPane); + contentPane.setLayout(mainLayout); + + mainLayout.setHorizontalGroup( + mainLayout.createSequentialGroup().addContainerGap().addGroup( + mainLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(viewerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addContainerGap()); + mainLayout.setVerticalGroup( + mainLayout.createSequentialGroup() + .addContainerGap() + .addComponent(viewerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(buttonPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addContainerGap()); + } + + /** + * + * @param messages + * @param content + * @param mimeType defaults to text/plain if null + * @param encoding must be null if document contains charset declaration (e.g. HTML page), otherwise the parser crashes + * @param helpListener may be null + * @return + */ + private JPanel createViewerPanel(String viewerLabelText, + Reader content, + String mimeType, + final ActionListener helpListener) { + log.debug("viewer dialog: " + mimeType); + + if (mimeType == null) { + mimeType = "text/plain"; + } else if ("application/xhtml+xml".equals(mimeType)) { + mimeType = "text/html"; + } + + JEditorPane viewer = new JEditorPane(); + viewer.setEditable(false); + viewer.setContentType(mimeType); + if ("text/plain".equals(mimeType)) { + viewer.setFont(new Font(PLAINTEXT_FONT, viewer.getFont().getStyle(), viewer.getFont().getSize())); + } + + EditorKit editorKit = viewer.getEditorKit(); + Document document = editorKit.createDefaultDocument(); +// document.putProperty("IgnoreCharsetDirective", new Boolean(true)); + + try { + viewer.read(content, document); + content.close(); + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + String p = messages.getString(BKUGUIFacade.ERR_VIEWER); + viewer.setText(MessageFormat.format(p, ex.getMessage())); + } + + JScrollPane scrollPane = new JScrollPane(viewer); + scrollPane.setPreferredSize(viewer.getPreferredSize()); + scrollPane.setAlignmentX(LEFT_ALIGNMENT); + viewer.setCaretPosition(0); + + JLabel viewerLabel = new JLabel(); + viewerLabel.setText(viewerLabelText); + viewerLabel.setFont(viewerLabel.getFont().deriveFont(viewerLabel.getFont().getStyle() | java.awt.Font.BOLD)); + viewerLabel.setLabelFor(viewer); + + JPanel viewerPanel = new JPanel(); + GroupLayout viewerPanelLayout = new GroupLayout(viewerPanel); + viewerPanel.setLayout(viewerPanelLayout); + + if (helpListener != null) { + JLabel helpLabel = new JLabel(); + helpLabel.setIcon(new ImageIcon(getClass().getResource(BKUGUIFacade.HELP_IMG))); + helpLabel.addMouseListener(new MouseAdapter() { + + @Override + public void mouseClicked(MouseEvent arg0) { + ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, BKUGUIFacade.HELP_HASHDATAVIEWER); + helpListener.actionPerformed(e); + } + }); + helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + viewerPanelLayout.setHorizontalGroup( + viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(viewerPanelLayout.createSequentialGroup().addComponent(viewerLabel).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel)).addComponent(scrollPane)); //, 0, 0, Short.MAX_VALUE)); + viewerPanelLayout.setVerticalGroup( + viewerPanelLayout.createSequentialGroup() + .addGroup(viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(viewerLabel) + .addComponent(helpLabel)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(scrollPane)); + } else { + viewerPanelLayout.setHorizontalGroup( + viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(viewerLabel) + .addComponent(scrollPane)); + viewerPanelLayout.setVerticalGroup( + viewerPanelLayout.createSequentialGroup() + .addComponent(viewerLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(scrollPane)); + + } + + return viewerPanel; + } + + private JPanel createButtonPanel(ActionListener saveListener, String saveCommand) { + JButton closeButton = new JButton(); + closeButton.setText(messages.getString(BKUGUIFacade.BUTTON_CLOSE)); + closeButton.addActionListener(this); + + JButton saveButton = new JButton(); + saveButton.setText(messages.getString(BKUGUIFacade.BUTTON_SAVE)); + saveButton.setActionCommand(saveCommand); + saveButton.addActionListener(saveListener); + + int buttonSize = closeButton.getPreferredSize().width; + if (saveButton.getPreferredSize().width > buttonSize) { + buttonSize = saveButton.getPreferredSize().width; + } + + JPanel buttonPanel = new JPanel(); + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(closeButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(saveButton).addComponent(closeButton)); + + return buttonPanel; + } + + @Override + public void actionPerformed(ActionEvent e) { + HashDataViewer.dialog.setVisible(false); + } +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java index 531884d1..b7bbe971 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java @@ -28,23 +28,27 @@ public class HelpMouseListener extends MouseAdapter { protected static final Log log = LogFactory.getLog(HelpMouseListener.class); - protected ActionListener externalHelpListener; + protected ActionListener helpListener; protected String locale; protected String topic; public HelpMouseListener(ActionListener externalHelpListener) { super(); - this.externalHelpListener = externalHelpListener; + this.helpListener = externalHelpListener; } public void setHelpTopic(String topic) { log.trace("setting help topic: " + topic); this.topic = topic; } + + public ActionListener getActionListener() { + return helpListener; + } @Override public void mouseClicked(MouseEvent arg0) { ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, topic); - externalHelpListener.actionPerformed(e); + helpListener.actionPerformed(e); } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java new file mode 100644 index 00000000..42ca2090 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java @@ -0,0 +1,211 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.gui; + +import at.gv.egiz.bku.gui.*; +import java.applet.AppletContext; +import java.awt.Component; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.IOException; +import java.net.URL; +import java.text.MessageFormat; +import java.util.ResourceBundle; +import javax.swing.GroupLayout; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JEditorPane; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.LayoutStyle; +import javax.swing.SwingUtilities; +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkListener; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker + */ +public class HelpViewer extends JDialog + implements ActionListener { + + protected static final Log log = LogFactory.getLog(HelpViewer.class); + private static HelpViewer dialog; + protected ResourceBundle messages; + protected AppletContext ctx; + + /** + * + * @param ctx external links are opened via ctx.showDocument() + * @param helpURL + * @param helpTopic + * @param messages + */ + public static void showHelpDialog(AppletContext ctx, + URL helpURL, + String helpTopic, + ResourceBundle messages) { + showHelpDialog(null, ctx, helpURL, helpTopic, messages); + } + + public static void showHelpDialog(URL helpURL, + String helpTopic, + ResourceBundle messages) { + showHelpDialog(null, null, helpURL, helpTopic, messages); + } + + public static void showHelpDialog(Component owner, + AppletContext ctx, + URL helpURL, + String helpTopic, + ResourceBundle messages) { + + Frame frame = null; + if (owner != null) { + JOptionPane.getFrameForComponent(owner); + } + dialog = new HelpViewer(frame, messages, ctx, helpURL, helpTopic); + dialog.setVisible(true); + } + + private HelpViewer(Frame frame, + ResourceBundle messages, + AppletContext ctx, + URL helpURL, + String helpTopic) { + super(frame, messages.getString(BKUGUIFacade.WINDOWTITLE_HELP), true); + this.messages = messages; + this.ctx = ctx; + + String p = messages.getString(BKUGUIFacade.MESSAGE_HELP); + String helpItem = messages.getString(helpTopic); + String viewerLabel = MessageFormat.format(p, new Object[]{helpItem}); + + JPanel helpPanel = createViewerPanel(viewerLabel, helpURL); + JPanel buttonPanel = createButtonPanel(); + + initContentPane(new Dimension(600, 400), helpPanel, buttonPanel); + pack(); + if (frame != null) { + setLocationRelativeTo(frame); + } else { + setLocationByPlatform(true); + } + } + + private void initContentPane(Dimension preferredSize, JPanel viewerPanel, JPanel buttonPanel) { + Container contentPane = getContentPane(); + contentPane.setPreferredSize(preferredSize); + + GroupLayout mainLayout = new GroupLayout(contentPane); + contentPane.setLayout(mainLayout); + + mainLayout.setHorizontalGroup( + mainLayout.createSequentialGroup().addContainerGap().addGroup( + mainLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(viewerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addContainerGap()); + mainLayout.setVerticalGroup( + mainLayout.createSequentialGroup().addContainerGap().addComponent(viewerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(buttonPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addContainerGap()); + } + + private JPanel createViewerPanel(String viewerLabelText, URL helpURL) { + log.debug("viewer dialog: " + helpURL.toString()); + + final JEditorPane viewer = new JEditorPane(); + viewer.setEditable(false); + try { + viewer.setPage(helpURL); + viewer.addHyperlinkListener(new HyperlinkListener() { + + @Override + public void hyperlinkUpdate(HyperlinkEvent e) { + final URL url = e.getURL(); + if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { + if (ctx != null) { + log.debug("open external link in help viewer: " + url); + ctx.showDocument(url, "_blank"); + } else { + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + String msgP = messages.getString(BKUGUIFacade.ERR_EXTERNAL_LINK); + String msg = MessageFormat.format(msgP, url); + String title = messages.getString(BKUGUIFacade.TITLE_ERROR); + JOptionPane.showMessageDialog(rootPane, msg, title, JOptionPane.ERROR_MESSAGE); + } + }); + } + } + } + }); + } catch (IOException ex) { + String p = messages.getString(BKUGUIFacade.ERR_VIEWER); + viewer.setText(MessageFormat.format(p, new Object[]{ex.getMessage()})); + } + + JScrollPane scrollPane = new JScrollPane(viewer); + scrollPane.setPreferredSize(viewer.getPreferredSize()); + scrollPane.setAlignmentX(LEFT_ALIGNMENT); + viewer.setCaretPosition(0); + + JLabel viewerLabel = new JLabel(); + viewerLabel.setText(viewerLabelText); + viewerLabel.setFont(viewerLabel.getFont().deriveFont(viewerLabel.getFont().getStyle() | java.awt.Font.BOLD)); + viewerLabel.setLabelFor(viewer); + + JPanel viewerPanel = new JPanel(); + GroupLayout viewerPanelLayout = new GroupLayout(viewerPanel); + viewerPanel.setLayout(viewerPanelLayout); + + viewerPanelLayout.setHorizontalGroup( + viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(viewerLabel).addComponent(scrollPane)); + viewerPanelLayout.setVerticalGroup( + viewerPanelLayout.createSequentialGroup().addComponent(viewerLabel).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(scrollPane)); + + return viewerPanel; + } + + private JPanel createButtonPanel() { + JButton closeButton = new JButton(); + closeButton.setText(messages.getString(BKUGUIFacade.BUTTON_CLOSE)); + closeButton.addActionListener(this); + + JPanel buttonPanel = new JPanel(); + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(closeButton)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createSequentialGroup().addComponent(closeButton)); + return buttonPanel; + } + + @Override + public void actionPerformed(ActionEvent e) { + HelpViewer.dialog.setVisible(false); + } +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java index 6250dd0e..a810d34c 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java @@ -954,7 +954,8 @@ public class SimpleGUI implements BKUGUIFacade { log.debug("show plaintext hashdatainput dialog"); - ViewerDialog.showHashDataInput(contentPane, signedReferences, messages, saveListener, saveCommand, helpListener); + ActionListener l = helpListener.getActionListener(); + HashDataViewer.showHashDataInput(contentPane, signedReferences, messages, saveListener, saveCommand, l); } }); } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerDialog.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerDialog.java deleted file mode 100644 index e643c876..00000000 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerDialog.java +++ /dev/null @@ -1,357 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package at.gv.egiz.bku.gui; - -import at.gv.egiz.stal.HashDataInput; -import java.awt.Component; -import java.awt.Container; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Frame; -import java.awt.Point; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.net.URL; -import java.net.URLConnection; -import java.nio.charset.Charset; -import java.text.MessageFormat; -import java.util.List; -import java.util.ResourceBundle; -import javax.swing.GroupLayout; -import javax.swing.ImageIcon; -import javax.swing.JButton; -import javax.swing.JDialog; -import javax.swing.JEditorPane; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.LayoutStyle; -import javax.swing.text.Document; -import javax.swing.text.EditorKit; -import javax.swing.text.html.HTMLDocument; -import javax.swing.text.html.HTMLEditorKit; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * - * @author Clemens Orthacker - */ -public class ViewerDialog extends JDialog - implements ActionListener { - - public static final String PLAINTEXT_FONT = "Monospaced"; - protected static final Log log = LogFactory.getLog(ViewerDialog.class); -// private ViewerDialog dialog; - - protected ResourceBundle messages; - - /** - * - * @param frameComp - * @param signedReferences currently, only one hashdata input (the first in the list) is displayed - * @param messages - * @param saveListener - * @param saveCommand - * @param helpListener - */ - public static void showHashDataInput(Component frameComp, - List hashDataInputs, - ResourceBundle messages, - ActionListener saveListener, - String saveCommand, - HelpMouseListener helpListener) { - - Frame frame = null; - if (frameComp != null) { - JOptionPane.getFrameForComponent(frameComp); - } - ViewerDialog viewer = new ViewerDialog(frame, - messages, - hashDataInputs, - saveListener, - saveCommand, - helpListener); - viewer.setVisible(true); - } - - public static void showHelp(Component frameComp, - String helpTopic, -// Reader helpDocument, - InputStream helpDocument, - String mimeType, - ResourceBundle messages) { - - Frame frame = null; - if (frameComp != null) { - JOptionPane.getFrameForComponent(frameComp); - } - ViewerDialog viewer = new ViewerDialog(frame, messages, helpTopic, helpDocument, mimeType); - viewer.setVisible(true); - } - - /** - * TODO make encoding aware! - * @param frame - * @param title - * @param messages - * @param hashDataInputs - * @param saveListener - * @param saveCommand - * @param helpListener - */ - private ViewerDialog(Frame frame, - ResourceBundle messages, - List hashDataInputs, - ActionListener saveListener, - String saveCommand, - HelpMouseListener helpListener) { - super(frame, messages.getString(BKUGUIFacade.WINDOWTITLE_VIEWER), true); - this.messages = messages; - - HashDataInput hashData = hashDataInputs.get(0); - -// Charset cs; -// if (hashData.getEncoding() == null) { -// cs = Charset.forName("UTF-8"); -// } else { -// try { -// cs = Charset.forName(hashData.getEncoding()); -// } catch (Exception ex) { -// log.debug("charset " + hashData.getEncoding() + " not supported, assuming UTF-8: " + ex.getMessage()); -// cs = Charset.forName("UTF-8"); -// } -// } - -// InputStreamReader isr = new InputStreamReader(hashData.getHashDataInput(), cs); -// Reader content = new BufferedReader(isr); - InputStream content = hashData.getHashDataInput(); - String mimeType = hashData.getMimeType(); - String encoding = hashData.getEncoding(); - if (encoding == null) { - encoding = "UTF-8"; - } - - JPanel hashDataPanel = createViewerPanel(messages.getString(BKUGUIFacade.MESSAGE_HASHDATA), content, mimeType, encoding, helpListener); - JPanel buttonPanel = createButtonPanel(saveListener, saveCommand); - initContentPane(new Dimension(600, 400), hashDataPanel, buttonPanel); - - pack(); - if (frame != null) { - setLocationRelativeTo(frame); - } else { - setLocationByPlatform(true); - } - } - - private ViewerDialog(Frame frame, - ResourceBundle messages, - String helpTopic, -// Reader helpDocument, - InputStream helpDocument, - String mimeType) { - super(frame, messages.getString(BKUGUIFacade.WINDOWTITLE_HELP), true); - this.messages = messages; - - String p = messages.getString(BKUGUIFacade.MESSAGE_HELP); - String helpItem = messages.getString(helpTopic); - String viewerLabel = MessageFormat.format(p, new Object[] {helpItem}); - - JPanel helpPanel = createViewerPanel(viewerLabel, helpDocument, mimeType, null, null); - JPanel buttonPanel = createButtonPanel(); - - initContentPane(new Dimension(600, 400), helpPanel, buttonPanel); - pack(); - if (frame != null) { - setLocationRelativeTo(frame); - } else { - setLocationByPlatform(true); - } - } - - private void initContentPane(Dimension preferredSize, JPanel viewerPanel, JPanel buttonPanel) { - Container contentPane = getContentPane(); - contentPane.setPreferredSize(preferredSize); - - GroupLayout mainLayout = new GroupLayout(contentPane); - contentPane.setLayout(mainLayout); - - mainLayout.setHorizontalGroup( - mainLayout.createSequentialGroup().addContainerGap().addGroup( - mainLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(viewerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addContainerGap()); - mainLayout.setVerticalGroup( - mainLayout.createSequentialGroup() - .addContainerGap() - .addComponent(viewerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(buttonPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addContainerGap()); - } - - /** - * - * @param messages - * @param content - * @param mimeType defaults to text/plain if null - * @param encoding must be null if document contains charset declaration (e.g. HTML page), otherwise the parser crashes - * @param helpListener may be null - * @return - */ - private JPanel createViewerPanel(String viewerLabelText, InputStream content, String mimeType, String encoding, HelpMouseListener helpListener) { - log.debug("viewer dialog: " + mimeType); - - if (mimeType == null) { - mimeType = "text/plain"; - } else if ("application/xhtml+xml".equals(mimeType)) { - mimeType = "text/html"; - } - - JEditorPane viewer = new JEditorPane(); - viewer.setEditable(false); - viewer.setContentType(mimeType); - if ("text/plain".equals(mimeType)) { - viewer.setFont(new Font(PLAINTEXT_FONT, viewer.getFont().getStyle(), viewer.getFont().getSize())); - } - - EditorKit editorKit = viewer.getEditorKit(); - Document document = editorKit.createDefaultDocument(); -// document.putProperty("IgnoreCharsetDirective", new Boolean(true)); - - try { - if (encoding != null) { - BufferedReader contentReader = new BufferedReader(new InputStreamReader(content, encoding)); - viewer.read(contentReader, document); - contentReader.close(); - } else { - // charset declaration in content - viewer.read(content, document); - content.close(); - } - } catch (Exception ex) { - log.error(ex.getMessage(), ex); - String p = messages.getString(BKUGUIFacade.ERR_VIEWER); - viewer.setText(MessageFormat.format(p, ex.getMessage())); - } - - JScrollPane scrollPane = new JScrollPane(viewer); - scrollPane.setPreferredSize(viewer.getPreferredSize()); - scrollPane.setAlignmentX(LEFT_ALIGNMENT); - viewer.setCaretPosition(0); - - JLabel viewerLabel = new JLabel(); - viewerLabel.setText(viewerLabelText); - viewerLabel.setFont(viewerLabel.getFont().deriveFont(viewerLabel.getFont().getStyle() | java.awt.Font.BOLD)); - viewerLabel.setLabelFor(viewer); - - JPanel viewerPanel = new JPanel(); - GroupLayout viewerPanelLayout = new GroupLayout(viewerPanel); - viewerPanel.setLayout(viewerPanelLayout); - - if (helpListener != null) { - JLabel helpLabel = new JLabel(); - helpListener.setHelpTopic(BKUGUIFacade.HELP_HASHDATAVIEWER); - helpLabel.setIcon(new ImageIcon(getClass().getResource(BKUGUIFacade.HELP_IMG))); - helpLabel.addMouseListener(helpListener); - helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - viewerPanelLayout.setHorizontalGroup( - viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(viewerPanelLayout.createSequentialGroup().addComponent(viewerLabel).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel)).addComponent(scrollPane)); //, 0, 0, Short.MAX_VALUE)); - viewerPanelLayout.setVerticalGroup( - viewerPanelLayout.createSequentialGroup() - .addGroup(viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(viewerLabel) - .addComponent(helpLabel)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(scrollPane)); - } else { - viewerPanelLayout.setHorizontalGroup( - viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(viewerLabel) - .addComponent(scrollPane)); - viewerPanelLayout.setVerticalGroup( - viewerPanelLayout.createSequentialGroup() - .addComponent(viewerLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(scrollPane)); - - } - - return viewerPanel; - } - - private JPanel createButtonPanel() { - JButton closeButton = new JButton(); - closeButton.setText(messages.getString(BKUGUIFacade.BUTTON_CLOSE)); - closeButton.addActionListener(this); - - JPanel buttonPanel = new JPanel(); - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - buttonPanelLayout.setHorizontalGroup( - buttonPanelLayout.createSequentialGroup() - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(closeButton)); - buttonPanelLayout.setVerticalGroup( - buttonPanelLayout.createSequentialGroup() - .addComponent(closeButton)); - return buttonPanel; - } - - private JPanel createButtonPanel(ActionListener saveListener, String saveCommand) { - JButton closeButton = new JButton(); - closeButton.setText(messages.getString(BKUGUIFacade.BUTTON_CLOSE)); - closeButton.addActionListener(this); - - JButton saveButton = new JButton(); - saveButton.setText(messages.getString(BKUGUIFacade.BUTTON_SAVE)); - saveButton.setActionCommand(saveCommand); - saveButton.addActionListener(saveListener); - - int buttonSize = closeButton.getPreferredSize().width; - if (saveButton.getPreferredSize().width > buttonSize) { - buttonSize = saveButton.getPreferredSize().width; - } - - JPanel buttonPanel = new JPanel(); - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - buttonPanelLayout.setHorizontalGroup( - buttonPanelLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(closeButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); - buttonPanelLayout.setVerticalGroup( - buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(saveButton).addComponent(closeButton)); - - return buttonPanel; - } - - @Override - public void actionPerformed(ActionEvent e) { -// if ("close".equals(e.getActionCommand())) { -// ViewerDialog.dialog.setVisible(false); -// HashDataViewer.dialog.dispose(); - this.setVisible(false); - } -} diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index ba20471d..6c049c85 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -67,6 +67,7 @@ error.test=Fehler1 {0} - Fehler2 {1} error.card.locked=B\u00FCrgerkarte ist gesperrt error.card.notactivated=B\u00FCrgerkartenfunktion ist nicht aktiviert error.viewer=Der Inhalt kann nicht dargestellt werden: {0} +error.external.link=Externer Link {0} wird nicht ge\u00F6ffnet # Help Topics help.welcome=Startseite diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties index edc5371d..80dc4234 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties @@ -65,6 +65,7 @@ error.test=Error1 {0} - Error2 {1} error.card.locked=Citizen-card is locked error.card.notactivated=Citizen-card not activated error.viewer=Failed to display contents: {0} +error.external.link=Externer Link {0} wird nicht ge\u00F6ffnet # Help Topics help.welcome=Welcome page diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java index e32c9c3d..d551ae0d 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java @@ -39,7 +39,7 @@ public class LocalHelpListener extends AbstractHelpListener { } @Override - public void showDocument(URL helpDocument) throws IOException, URISyntaxException { + public void showDocument(URL helpDocument, String helpTopic) throws IOException, URISyntaxException { if (desktop == null) { log.error("Failed to open default browser: Desktop API not available (libgnome installed?)"); } else { diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java index 39e997b7..fb8f2432 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java @@ -84,14 +84,6 @@ public class BKUGuiProxy implements BKUGUIFacade { delegate.showErrorDialog(errorMsgKey, errorMsgParams); } - @Override - public void showHashDataInputDialog(List signedReferences, - ActionListener okListener, String actionCommand) { - showDialog(); - delegate.showHashDataInputDialog(signedReferences, okListener, - actionCommand); - } - @Override public void showInsertCardDialog(ActionListener cancelListener, String actionCommand) { @@ -131,4 +123,14 @@ public class BKUGuiProxy implements BKUGUIFacade { showDialog(); delegate.showWelcomeDialog(); } + + @Override + public void showHashDataInputDialog(List signedReferences, + boolean externalDisplay, + ActionListener okListener, + String okCommand) { + showDialog(); + delegate.showHashDataInputDialog(signedReferences, externalDisplay, okListener, + okCommand); + } } -- cgit v1.2.3 From f09efb78459c7cd49ca4e28d92f170833e7ee32d Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 14 Nov 2008 16:30:28 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@172 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../gv/egiz/bku/online/applet/AppletBKUWorker.java | 1 - .../at/gv/egiz/bku/online/applet/BKUApplet.java | 5 +- .../bku/online/applet/DefaultHelpListener.java | 55 -------------- BKUApplet/src/test/resources/appletTest.html | 4 +- .../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 1 + .../at/gv/egiz/bku/gui/DefaultHelpListener.java | 62 ++++++++++++++++ .../java/at/gv/egiz/bku/gui/HashDataViewer.java | 15 +++- .../main/java/at/gv/egiz/bku/gui/HelpViewer.java | 5 +- .../main/java/at/gv/egiz/bku/gui/ImagePanel.java | 4 +- .../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 6 ++ .../egiz/bku/gui/html/RestrictedHTMLEditorKit.java | 49 +++++++++++++ .../gv/egiz/bku/gui/html/RestrictedImageView.java | 67 +++++++++++++++++ .../at/gv/egiz/bku/gui/Messages.properties | 4 +- .../at/gv/egiz/bku/gui/Messages_en.properties | 3 +- BKUCommonGUI/src/main/resources/images/help.png | Bin 303 -> 441 bytes .../src/main/resources/images/help_orig.png | Bin 0 -> 303 bytes .../at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 7 +- BKULocal/src/main/webapp/WEB-INF/web.xml | 40 ++++++---- BKULocal/src/main/webapp/help.jsp | 29 ++++++++ .../webapp/helpfiles/de/error.card.locked.html | 46 ++++++++++++ .../main/webapp/helpfiles/de/error.card.locked.png | Bin 0 -> 1325 bytes .../helpfiles/de/error.card.notactivated.html | 43 +++++++++++ .../helpfiles/de/error.card.notactivated.png | Bin 0 -> 1419 bytes .../webapp/helpfiles/de/error.cardterminal.html | 42 +++++++++++ .../webapp/helpfiles/de/error.cardterminal.png | Bin 0 -> 1490 bytes .../src/main/webapp/helpfiles/de/error.pcsc.html | 40 ++++++++++ .../src/main/webapp/helpfiles/de/error.pcsc.png | Bin 0 -> 3684 bytes .../webapp/helpfiles/de/error.ws.unreachable.html | 39 ++++++++++ .../webapp/helpfiles/de/error.ws.unreachable.png | Bin 0 -> 2561 bytes .../webapp/helpfiles/de/help.cardnotsupported.html | 47 ++++++++++++ .../webapp/helpfiles/de/help.cardnotsupported.png | Bin 0 -> 1113 bytes .../src/main/webapp/helpfiles/de/help.cardpin.html | 41 +++++++++++ .../src/main/webapp/helpfiles/de/help.cardpin1.png | Bin 0 -> 1334 bytes .../src/main/webapp/helpfiles/de/help.cardpin2.png | Bin 0 -> 1324 bytes .../webapp/helpfiles/de/help.hashdataviewer.html | 39 ++++++++++ .../webapp/helpfiles/de/help.hashdataviewer.png | Bin 0 -> 11310 bytes .../main/webapp/helpfiles/de/help.insertcard.html | 42 +++++++++++ .../main/webapp/helpfiles/de/help.insertcard.png | Bin 0 -> 1207 bytes .../src/main/webapp/helpfiles/de/help.retry.html | 40 ++++++++++ .../src/main/webapp/helpfiles/de/help.retry.png | Bin 0 -> 1711 bytes .../main/webapp/helpfiles/de/help.signpin-1.png | Bin 0 -> 12818 bytes .../src/main/webapp/helpfiles/de/help.signpin.html | 45 ++++++++++++ .../src/main/webapp/helpfiles/de/help.signpin.png | Bin 0 -> 1511 bytes .../src/main/webapp/helpfiles/de/help.wait.html | 39 ++++++++++ .../src/main/webapp/helpfiles/de/help.wait.png | Bin 0 -> 981 bytes .../src/main/webapp/helpfiles/de/help.welcome.html | 40 ++++++++++ .../src/main/webapp/helpfiles/de/help.welcome.png | Bin 0 -> 2152 bytes BKULocal/src/main/webapp/helpfiles/help.css | 81 +++++++++++++++++++++ BKULocal/src/main/webapp/helpfiles/index.html | 17 +++++ .../src/main/webapp/img/BackgroundChipperling.png | Bin 0 -> 2041 bytes BKUOnline/src/main/webapp/img/BackgroundMocca.png | Bin 0 -> 1287 bytes 51 files changed, 910 insertions(+), 88 deletions(-) delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/DefaultHelpListener.java create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedHTMLEditorKit.java create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedImageView.java create mode 100644 BKUCommonGUI/src/main/resources/images/help_orig.png create mode 100644 BKULocal/src/main/webapp/help.jsp create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.card.locked.html create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.card.locked.png create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.card.notactivated.html create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.card.notactivated.png create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.html create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.png create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.pcsc.html create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.pcsc.png create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.html create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.png create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.html create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.png create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.cardpin.html create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.cardpin1.png create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.cardpin2.png create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.html create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.png create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.insertcard.html create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.insertcard.png create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.retry.html create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.retry.png create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.signpin-1.png create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.signpin.html create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.signpin.png create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.wait.html create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.wait.png create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.welcome.html create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.welcome.png create mode 100644 BKULocal/src/main/webapp/helpfiles/help.css create mode 100644 BKULocal/src/main/webapp/helpfiles/index.html create mode 100644 BKUOnline/src/main/webapp/img/BackgroundChipperling.png create mode 100644 BKUOnline/src/main/webapp/img/BackgroundMocca.png (limited to 'BKUApplet') diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java index db88c037..f862360b 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java @@ -31,7 +31,6 @@ import at.gv.egiz.stal.service.types.RequestType; import at.gv.egiz.stal.service.types.ResponseType; import at.gv.egiz.stal.util.STALTranslator; import java.applet.AppletContext; -import java.awt.Dimension; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; 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 4b49c5d5..7963768e 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 @@ -16,6 +16,7 @@ */ package at.gv.egiz.bku.online.applet; +import at.gv.egiz.bku.gui.DefaultHelpListener; import at.gv.egiz.bku.gui.AbstractHelpListener; import java.net.MalformedURLException; import java.net.URL; @@ -92,12 +93,12 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { // helpListener = new BrowserHelpListener(getAppletContext(), helpURL, getLocale()); helpListener = new DefaultHelpListener(getAppletContext(), helpURL, getLocale()); } catch (MalformedURLException ex) { - log.warn("failed to load help URL, disabling help: " + ex.getMessage()); + log.warn("failed to load help URL: " + ex.getMessage() + ", disabling help"); } try { backgroundImgURL = getURLParameter(BACKGROUND_PARAM); } catch (MalformedURLException ex) { - log.info("failed to load applet background image, using default: " + ex.getMessage()); + log.warn("failed to load applet background image: " + ex.getMessage() + ", using default"); } if (locale != null) { 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 deleted file mode 100644 index 6eec5665..00000000 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/DefaultHelpListener.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package at.gv.egiz.bku.online.applet; - -import at.gv.egiz.bku.gui.HelpViewer; -import at.gv.egiz.bku.gui.AbstractHelpListener; -import java.applet.AppletContext; -import java.net.URL; -import java.util.Locale; -import javax.swing.SwingUtilities; - -/** - * - * @author Clemens Orthacker - */ -public class DefaultHelpListener extends AbstractHelpListener { - - protected AppletContext ctx; - - public DefaultHelpListener(AppletContext ctx, URL helpURL, Locale locale) { - super(helpURL, locale); - this.ctx = ctx; - } - - @Override - public void showDocument(final URL helpURL, final String helpTopic) throws Exception { - log.debug("schedule help dialog"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - log.debug("show help dialog"); - - HelpViewer.showHelpDialog(ctx, helpURL, helpTopic, messages); - - } - }); - } -} diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html index 1ba88e47..eaf6376d 100644 --- a/BKUApplet/src/test/resources/appletTest.html +++ b/BKUApplet/src/test/resources/appletTest.html @@ -21,9 +21,9 @@ archive="../BKUApplet-1.0-SNAPSHOT.jar, ../test-libs/commons-logging-1.1.1.jar , ../test-libs/iaik_jce_me4se-3.04.jar" width=300 height=200> - + - + diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index c7032f90..87982c79 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -89,6 +89,7 @@ public interface BKUGUIFacade { public static final String BUTTON_SAVE = "button.save"; public static final String BUTTON_CLOSE = "button.close"; public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix"; + public static final String ALT_HELP = "alt.help"; public void init(Container contentPane, Locale locale, URL background, ActionListener helpListener); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java new file mode 100644 index 00000000..ba968a48 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java @@ -0,0 +1,62 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package at.gv.egiz.bku.gui; + +import java.applet.AppletContext; +import java.net.URL; +import java.util.Locale; +import javax.swing.SwingUtilities; + +/** + * + * @author Clemens Orthacker + */ +public class DefaultHelpListener extends AbstractHelpListener { + + protected AppletContext ctx; + + public DefaultHelpListener(AppletContext ctx, URL helpURL, Locale locale) { + super(helpURL, locale); + this.ctx = ctx; + } + + public DefaultHelpListener(URL helpURL, Locale locale) { + super(helpURL, locale); + this.ctx = null; + } + + @Override + public void showDocument(final URL helpURL, final String helpTopic) throws Exception { + log.debug("schedule help dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show help dialog"); + + if (ctx == null) { + HelpViewer.showHelpDialog(helpURL, helpTopic, messages); + + } else { + HelpViewer.showHelpDialog(ctx, helpURL, helpTopic, messages); + } + } + }); + } +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java index 8883098a..31887bde 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java @@ -16,6 +16,7 @@ */ package at.gv.egiz.bku.gui; +import at.gv.egiz.bku.gui.html.RestrictedHTMLEditorKit; import at.gv.egiz.stal.HashDataInput; import java.awt.Component; import java.awt.Container; @@ -23,6 +24,7 @@ import java.awt.Cursor; import java.awt.Dimension; import java.awt.Font; import java.awt.Frame; +import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; @@ -47,6 +49,11 @@ import javax.swing.JScrollPane; import javax.swing.LayoutStyle; import javax.swing.text.Document; import javax.swing.text.EditorKit; +import javax.swing.text.Element; +import javax.swing.text.ViewFactory; +import javax.swing.text.html.HTML; +import javax.swing.text.html.HTMLEditorKit; +import javax.swing.text.html.ImageView; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -184,11 +191,14 @@ public class HashDataViewer extends JDialog } JEditorPane viewer = new JEditorPane(); - viewer.setEditable(false); - viewer.setContentType(mimeType); + if ("text/plain".equals(mimeType)) { viewer.setFont(new Font(PLAINTEXT_FONT, viewer.getFont().getStyle(), viewer.getFont().getSize())); +// } else if ("text/html".equals(mimeType)) { +// viewer.setEditorKitForContentType("text/html", new RestrictedHTMLEditorKit()); } + viewer.setEditable(false); + viewer.setContentType(mimeType); EditorKit editorKit = viewer.getEditorKit(); Document document = editorKit.createDefaultDocument(); @@ -220,6 +230,7 @@ public class HashDataViewer extends JDialog if (helpListener != null) { JLabel helpLabel = new JLabel(); helpLabel.setIcon(new ImageIcon(getClass().getResource(BKUGUIFacade.HELP_IMG))); + helpLabel.getAccessibleContext().setAccessibleName(messages.getString(BKUGUIFacade.ALT_HELP)); helpLabel.addMouseListener(new MouseAdapter() { @Override diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java index 42ca2090..173254e7 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java @@ -16,7 +16,6 @@ */ package at.gv.egiz.bku.gui; -import at.gv.egiz.bku.gui.*; import java.applet.AppletContext; import java.awt.Component; import java.awt.Container; @@ -30,7 +29,6 @@ import java.net.URL; import java.text.MessageFormat; import java.util.ResourceBundle; import javax.swing.GroupLayout; -import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JEditorPane; @@ -136,6 +134,7 @@ public class HelpViewer extends JDialog final JEditorPane viewer = new JEditorPane(); viewer.setEditable(false); try { + viewer.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); viewer.setPage(helpURL); viewer.addHyperlinkListener(new HyperlinkListener() { @@ -165,7 +164,7 @@ public class HelpViewer extends JDialog String p = messages.getString(BKUGUIFacade.ERR_VIEWER); viewer.setText(MessageFormat.format(p, new Object[]{ex.getMessage()})); } - + viewer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); JScrollPane scrollPane = new JScrollPane(viewer); scrollPane.setPreferredSize(viewer.getPreferredSize()); scrollPane.setAlignmentX(LEFT_ALIGNMENT); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java index 1185cf53..271c0b65 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java @@ -24,8 +24,8 @@ import javax.swing.ImageIcon; import javax.swing.JPanel; /** - * - * @author clemens + * + * @author Clemens Orthacker */ public class ImagePanel extends JPanel { diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java index a810d34c..bb568b75 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java @@ -158,6 +158,11 @@ public class SimpleGUI implements BKUGUIFacade { if (background == null) { background = this.getClass().getResource(DEFAULT_BACKGROUND); } + if ("file".equals(background.getProtocol())) { + log.warn("local background image not allowed: " + background); + background = this.getClass().getResource(DEFAULT_BACKGROUND); + } + log.debug("loading background " + background); contentPanel = new ImagePanel(background); // contentPanel.setBorder(new TitledBorder("content")); @@ -179,6 +184,7 @@ public class SimpleGUI implements BKUGUIFacade { helpLabel = new JLabel(); helpLabel.setIcon(new ImageIcon(getClass().getResource(HELP_IMG))); + helpLabel.getAccessibleContext().setAccessibleName(messages.getString(ALT_HELP)); helpLabel.addMouseListener(helpListener); helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedHTMLEditorKit.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedHTMLEditorKit.java new file mode 100644 index 00000000..680bf1a4 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedHTMLEditorKit.java @@ -0,0 +1,49 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.gui.html; + +import javax.swing.text.Element; +import javax.swing.text.StyleConstants; +import javax.swing.text.View; +import javax.swing.text.html.HTML; +import javax.swing.text.html.HTMLEditorKit; + +/** + * + * @author Clemens Orthacker + */ +public class RestrictedHTMLEditorKit extends HTMLEditorKit { + + + public static class RestrictedHTMLFactory extends HTMLFactory { + + @Override + public View create(Element elem) { + Object o = + elem.getAttributes().getAttribute(StyleConstants.NameAttribute); + if (o instanceof HTML.Tag) { + HTML.Tag kind = (HTML.Tag) o; + if (kind == HTML.Tag.IMG) + return new RestrictedImageView(elem); + } + return super.create( elem ); + } + + } + +} diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedImageView.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedImageView.java new file mode 100644 index 00000000..b1aa35db --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedImageView.java @@ -0,0 +1,67 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.gui.html; + +import javax.swing.text.Element; +import javax.swing.text.html.HTML; +import javax.swing.text.html.ImageView; + +/** + * + * @author Clemens Orthacker + */ +/** + * ImageViewer.refreshImage() (and loadImage()) is private :-( + */ + public class RestrictedImageView extends ImageView { + + public RestrictedImageView(Element elem) { + super(elem); + } + +// @Override +// public Image getImage() { +// int s = state; +// if ((s & RELOAD_IMAGE_FLAG) != 0) { +// refreshImage(); +// } +// s = state; +// if ((s & RELOAD_FLAG) != 0) { +// synchronized(this) { +// state = (state | RELOAD_FLAG) ^ RELOAD_FLAG; +// } +// setPropertiesFromAttributes(); +// } +// return super.getImage(); +// } + + /** + * check whether this URL corresponds to the data URI scheme + * (and the referenced content is directly included in the document). + * @return + */ + private boolean isDataURI() { + String src = (String)getElement().getAttributes(). + getAttribute(HTML.Attribute.SRC); + if (src == null) { + return false; + } + + return src.toLowerCase().startsWith("data"); + } + } \ No newline at end of file diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index 6c049c85..5f62c05a 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -31,7 +31,8 @@ message.wait=Bitte warten... message.insertcard=Bitte die B\u00FCrgerkarte in den Kartenleser stecken message.enterpin={0} eingeben message.hashdatalink=Signaturdaten anzeigen -message.hashdata=Dies ist eine Voransicht des zu signierenden Inhaltes. F\u00FCr Details siehe Hilfe. +message.hashdata=Hinweis: Dies ist eine Voransicht des zu signierenden Inhalts. F\u00FCr eine standardkonforme Darstellung siehe Hilfe (i). +#message.hashdata=Dies ist eine Voransicht des zu signierenden Inhaltes. F\u00FCr Details siehe Hilfe (i). #verwenden sie bitte die von ihrem System zur Verf\u00FCgung gestellte {0} Anwendung. message.hashdatalist={0} Signaturdaten: message.retries=Noch {0} Versuch(e) @@ -52,6 +53,7 @@ mimetype.desc.txt=Textdateien (.txt) mimetype.desc.pdf=Adobe PDF-Dateien (.pdf) mimetype.desc.bin=Bin\u00E4rdateien (.bin) save.hashdatainput.prefix=Signaturdaten +alt.help=Hilfe # Error Messages error.no.hashdata=Keine Signaturdaten verf\u00FCgbar: {0} diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties index 80dc4234..d963fd5f 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties @@ -31,7 +31,7 @@ message.wait=Please wait... message.insertcard=Please insert your citizen-card into the reader message.enterpin=Enter {0} message.hashdatalink=Display signature data -message.hashdata=Signature data: +message.hashdata=Remark: This is a preview of the data to-be signed. For standards compliant display see help. message.hashdatalist={0} signature data objects: message.retries={0} tries left message.overwrite=Overwrite {0}? @@ -51,6 +51,7 @@ mimetype.desc.txt=Textfiles (.txt) mimetype.desc.pdf=Adobe PDF-files (.pdf) mimetype.desc.bin=Binary files (.bin) save.hashdatainput.prefix=signaturedata +alt.help=help # Error Messages error.no.hashdata=No signature data available: {0} diff --git a/BKUCommonGUI/src/main/resources/images/help.png b/BKUCommonGUI/src/main/resources/images/help.png index 5d6da3bf..d1c36c33 100644 Binary files a/BKUCommonGUI/src/main/resources/images/help.png and b/BKUCommonGUI/src/main/resources/images/help.png differ diff --git a/BKUCommonGUI/src/main/resources/images/help_orig.png b/BKUCommonGUI/src/main/resources/images/help_orig.png new file mode 100644 index 00000000..5d6da3bf Binary files /dev/null and b/BKUCommonGUI/src/main/resources/images/help_orig.png differ diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java index ad7b9646..cad8cfb6 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java @@ -27,7 +27,7 @@ import javax.swing.WindowConstants; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIFactory; -import at.gv.egiz.bku.local.gui.LocalHelpListener; +import at.gv.egiz.bku.gui.DefaultHelpListener; import at.gv.egiz.stal.STAL; import at.gv.egiz.stal.STALFactory; import java.net.URL; @@ -49,10 +49,11 @@ public class SMCCSTALFactory implements STALFactory { dialog.setLocale(locale); } BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI); - LocalHelpListener helpListener = null; + DefaultHelpListener helpListener = null; try { if (helpURL != null) { - helpListener = new LocalHelpListener(new URL(helpURL), dialog.getLocale()); +// helpListener = new LocalHelpListener(new URL(helpURL), dialog.getLocale()); + helpListener = new DefaultHelpListener(new URL(helpURL), locale); } else { log.warn("no HELP URL configured, help system disabled"); } diff --git a/BKULocal/src/main/webapp/WEB-INF/web.xml b/BKULocal/src/main/webapp/WEB-INF/web.xml index 64f9a581..36087d17 100644 --- a/BKULocal/src/main/webapp/WEB-INF/web.xml +++ b/BKULocal/src/main/webapp/WEB-INF/web.xml @@ -1,20 +1,20 @@ - + http-security-layer-request @@ -36,6 +36,10 @@ BKUServlet at.gv.egiz.bku.local.webapp.SpringBKUServlet + + help + /help.jsp + BKUServlet /http-security-layer-request @@ -44,6 +48,10 @@ BKUServlet /https-security-layer-request + + help + /help/* + diff --git a/BKULocal/src/main/webapp/help.jsp b/BKULocal/src/main/webapp/help.jsp new file mode 100644 index 00000000..72781e38 --- /dev/null +++ b/BKULocal/src/main/webapp/help.jsp @@ -0,0 +1,29 @@ + +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +<%@ page import="java.util.Locale"%> +<% + String pathInfo[] = (request.getPathInfo() != null) ? request + .getPathInfo().split("/") : new String[] {}; + String language = pathInfo[1].split("_")[0]; + String filename = pathInfo[2]; + String path = "/helpfiles/" + language.toLowerCase() + "/" + filename; + System.out.println(path); +%> + + diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.card.locked.html b/BKULocal/src/main/webapp/helpfiles/de/error.card.locked.html new file mode 100644 index 00000000..c72ae275 --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/de/error.card.locked.html @@ -0,0 +1,46 @@ + + + + +Untitled Document + + + + + + +
+ +
+

Bildschirmfoto des Applets

+

Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.

+
+
+

Fehler: Bürgerkarte ist gesperrt

+

Die Bürgerkartenfunktion auf der gesteckten Chipkarte ist gesperrt. Es stehen keine weiteren Versuche zur Eingabe einer PIN zur Verfügung, da zu oft eine falsche PIN eingegeben wurde.

+

Bitte wenden sie sich an den Aussteller der Karte.

+ +


+
+ +
+ + diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.card.locked.png b/BKULocal/src/main/webapp/helpfiles/de/error.card.locked.png new file mode 100644 index 00000000..ed0c7eb1 Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/error.card.locked.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.card.notactivated.html b/BKULocal/src/main/webapp/helpfiles/de/error.card.notactivated.html new file mode 100644 index 00000000..a464cf17 --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/de/error.card.notactivated.html @@ -0,0 +1,43 @@ + + + + +Untitled Document + + + + + + +
+ +
+

Bildschirmfoto des Applets

+

Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.

+
+
+

Fehler: Bürgerkartenfunktion ist nicht aktiviert.

+

Die im Kartenleser gesteckte Chipkarte wird unterstützt, jedoch ist die Bürgerkartenfunktion auf der Chipkarte noch nicht aktiviert.

+

Um die gesteckte Chipkarte als Bürgerkarte verwenden zu können, + muss zuerst die + Bürgerkartenfunktion aktiviert werden. Für Informationen dazu siehe Aktivierung der Bürgerkartenfunktion auf www.buergerkarte.at.

+


+

+
+ +
+ + diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.card.notactivated.png b/BKULocal/src/main/webapp/helpfiles/de/error.card.notactivated.png new file mode 100644 index 00000000..dd48f92b Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/error.card.notactivated.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.html b/BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.html new file mode 100644 index 00000000..c93bba48 --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.html @@ -0,0 +1,42 @@ + + + + +Untitled Document + + + + + + +
+ +
+

Bildschirmfoto des Applets

+

Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.

+
+
+

Fehler: Es konnte kein Kartenleser gefunden werden.

+

Für den Zugriff auf die Bürgerkarte ist ein Chipkartenleser erforderlich. Es werden grundsätzlich alle Kartenleser unterstützt, die über die PC/SC-Schnittstelle angesprochen werden können und im Betriebssystem erfolgreich installiert wurden. Es können mehrere unterstützte Kartenleser gleichzeitig angeschlossen werden.

+

Kartenleser die, die nicht über die PC/SC-Schnittstelle angesprochen werden können (z.B. Kartenleser für die nur CT-API-Treiber verfügbar sind) werden nicht unterstützt.

+ +


+

+
+ +
+ + diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.png b/BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.png new file mode 100644 index 00000000..4276347d Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.pcsc.html b/BKULocal/src/main/webapp/helpfiles/de/error.pcsc.html new file mode 100644 index 00000000..44129e40 --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/de/error.pcsc.html @@ -0,0 +1,40 @@ + + + + +Untitled Document + + + + + + +
+ +
+

Bildschirmfoto des Applets

+

Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.

+
+
+

Fehler: Es konnte keine PC/SC-Schnittstelle gefunden werden

+

Die Software für den Zugriff auf die Bürgerkarte konnte keine PC/SC-Schnittstelle für den Zugriff auf Kartenleser erkennen. Das Betriebssystem scheint keine PC/SC-Schnittstelle zur Verfügung zu stellen.

+

Unter Betriebssystemen die PCSC-Lite verwenden (Linux u.a.) tritt dieses Problem auch auf, wenn kein Kartenleser angeschlossen ist und daher der entsprechende Dienst nicht gestartet wurde oder wenn die entsprechende Bibliothek nicht zur Verfügung steht (weitere Informationen).
+

+
+ +
+ + diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.pcsc.png b/BKULocal/src/main/webapp/helpfiles/de/error.pcsc.png new file mode 100644 index 00000000..94940733 Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/error.pcsc.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.html b/BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.html new file mode 100644 index 00000000..c0f2c762 --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.html @@ -0,0 +1,39 @@ + + + + +Untitled Document + + + + + + +
+ +
+

Bildschirmfoto des Applets

+

Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.

+
+
+

Fehler: Der Server ist nicht erreichbar

+

Die Software zum Zugriff auf die Bürgerkarte konnte den Server nicht erreichen. Möglicherweise besteht derzeit ein Problem mit dem Dienst. Probieren Sie es daher zu einem späteren Zeitpunkt nochmal. Sollte das Problem dauerhaft bestehen, wenden Sie sich bitte an den Betreiber der Anwendung.

+


+
+ +
+ + diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.png b/BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.png new file mode 100644 index 00000000..2570a01f Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.html b/BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.html new file mode 100644 index 00000000..c647bf72 --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.html @@ -0,0 +1,47 @@ + + + + +Untitled Document + + + + + + +
+ +
+

Bildschirmfoto des Applets

+

Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.

+
+
+

Die Karte wird nicht unterstützt

+

Die im Kartenleser gesteckte Chipkarte wird nicht unterstützt.

+

Bitte stecken Sie eine unterstützte Chipkarte (Bürgerkarte) in den Kartenleser. Derzeit werden die folgenden Chipkarten unterstützt:

+ +

Sind mehrere unterstützte Kartenleser angeschlossen, stecken sie eine unterstützte Chipkarte (Bürgerkarte) in einen der angeschlossenen Kartenleser. Wird die Chipkarte erkannt wechselt die Bildschirmanzeige. Wird die Chipkarte nicht erkannt, wird der Kartenleser möglicherweise nicht unterstützt. Stecken Sie die Chipkarte daher in einen anderen Kartenleser.

+


+
+ +
+ + diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.png b/BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.png new file mode 100644 index 00000000..23f6e2af Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.cardpin.html b/BKULocal/src/main/webapp/helpfiles/de/help.cardpin.html new file mode 100644 index 00000000..dc678fd0 --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/de/help.cardpin.html @@ -0,0 +1,41 @@ + + + + +Untitled Document + + + + + + +
+ +
+

Bildschirmfoto des Applets

+

Bildschirmfoto des Applets

+

Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.

+
+
+

Lesen von Informationen von der Chipkarte

+

Sie werden aufgefordert ihre Karten-PIN bzw. Infobox-PIN (abhängig von der verwendeten Bürgerkarte) einzugeben um das Auslesen von Informationen zur Identifikation (Personenbindung) bzw. Vollmachten zu ermöglichen.

+

Details zu den auf der Bürgerkarte gespeicherten Informationen finden sie auf www.buergerkarte.at.

+


+
+ +
+ + diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.cardpin1.png b/BKULocal/src/main/webapp/helpfiles/de/help.cardpin1.png new file mode 100644 index 00000000..4e1c2de8 Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.cardpin1.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.cardpin2.png b/BKULocal/src/main/webapp/helpfiles/de/help.cardpin2.png new file mode 100644 index 00000000..cc5e599e Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.cardpin2.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.html b/BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.html new file mode 100644 index 00000000..f7cf15df --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.html @@ -0,0 +1,39 @@ + + + + +Untitled Document + + + + + + +
+ +
+

Bildschirmfoto des Applets

+

Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.

+
+
+

Anzeige der Signaturdaten

+

Dieses Fenster zeigt die zu signierenden Daten an. Dies können entweder reine Textdaten oder XHTML sein. Im Falle von XHML erhalten Sie den Hinweis, dass es sich bei den dargestellten Daten nur um eine Voransicht handelt. Um die Daten standardkonform darzustellen, müssen diese abgespeichert und mit einem geeigneten XHTML Betrachter geöffnen werden.

+

In jedem Fall können die zu signierenden abgespeichert werden.

+
+ +
+ + diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.png b/BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.png new file mode 100644 index 00000000..83004322 Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.insertcard.html b/BKULocal/src/main/webapp/helpfiles/de/help.insertcard.html new file mode 100644 index 00000000..0bfc6230 --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/de/help.insertcard.html @@ -0,0 +1,42 @@ + + + + +Untitled Document + + + + + + +
+ +
+

Bildschirmfoto des Applets

+

Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.

+
+
+

Bitte die Bürgerkarte in den Kartenleser stecken

+

Die Software für den Zugriff auf die Bürgerkarte hat einen oder mehrere unterstützte Kartenleser gefunden.

+

Bitte stecken Sie nun ihre Bürgerkarte in den Kartenleser. Wird die Karte erkannt, welchselt die Bildschirmanzeige.

+

Sollten Sie mehrere Kartenleser angeschlossen haben, wählen Sie einen beliebigen aus. Wird die Karte im ausgewählten Kartenleser nicht erkannt, wird dieser Kartenleser eventuell nicht unterstützt. Probieren Sie es daher in einem anderen Kartenleser nochmal. +

+


+
+ +
+ + diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.insertcard.png b/BKULocal/src/main/webapp/helpfiles/de/help.insertcard.png new file mode 100644 index 00000000..9930fcb4 Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.insertcard.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.retry.html b/BKULocal/src/main/webapp/helpfiles/de/help.retry.html new file mode 100644 index 00000000..110d761f --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/de/help.retry.html @@ -0,0 +1,40 @@ + + + + +Untitled Document + + + + + + +
+ +
+

Bildschirmfoto des Applets

+

Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.

+
+
+

Falsche PIN

+

Die eingegebene PIN war falsch. Bitte geben Sie die korrekte PIN ein.

+

Die Anzahl der noch möglichen Versuche wird angezeigt.

+


+
+ +
+ + diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.retry.png b/BKULocal/src/main/webapp/helpfiles/de/help.retry.png new file mode 100644 index 00000000..4cab2430 Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.retry.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.signpin-1.png b/BKULocal/src/main/webapp/helpfiles/de/help.signpin-1.png new file mode 100644 index 00000000..1c5c8570 Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.signpin-1.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.signpin.html b/BKULocal/src/main/webapp/helpfiles/de/help.signpin.html new file mode 100644 index 00000000..9ff79f3b --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/de/help.signpin.html @@ -0,0 +1,45 @@ + + + + +Untitled Document + + + + + + +
+ +
+

Bildschirmfoto des Applets

+

Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.

+
+
+

Erstellen einer elektronischen Signatur

+

Sie werden aufgefordert die Signatur-PIN einzugeben, um eine elektronische Signatur zu erstellen.

+

Bildschirmfoto

+
    +
  1. Klicken Sie auf 'Signaturdaten anzeigen' um die zu signierenden Daten anzuzeigen.
  2. +
  3. Geben Sie im Formularfeld die Signatur-PIN ein.
  4. +
  5. Klicken Sie auf die Schaltfläche 'Signieren' um die elektronische Signatur zu erstellen.
  6. +
+


+
+ +
+ + diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.signpin.png b/BKULocal/src/main/webapp/helpfiles/de/help.signpin.png new file mode 100644 index 00000000..6ffbf8df Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.signpin.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.wait.html b/BKULocal/src/main/webapp/helpfiles/de/help.wait.html new file mode 100644 index 00000000..ed3db1b8 --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/de/help.wait.html @@ -0,0 +1,39 @@ + + + + +Untitled Document + + + + + + +
+ +
+

Bildschirmfoto des Applets

+

Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.

+
+
+

Bitte warten ...

+

Die Software für den Zugriff auf die Bürgerkarte ist damit beschäftigt, einen Befehl auszuführen bzw. auf einen neuen Befehl vom Server zu warten.

+


+
+ +
+ + diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.wait.png b/BKULocal/src/main/webapp/helpfiles/de/help.wait.png new file mode 100644 index 00000000..812da0bd Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.wait.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.welcome.html b/BKULocal/src/main/webapp/helpfiles/de/help.welcome.html new file mode 100644 index 00000000..9796a206 --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/de/help.welcome.html @@ -0,0 +1,40 @@ + + + + +Untitled Document + + + + + + +
+ +
+

Bildschirmfoto des Applets

+

Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.

+
+
+

Willkommen

+

Die Anzeige "Willkommen" erfolgt unmittelbar nachdem die Software für den Zugriff auf die Bürgerkarte erfolgreich im Browser geladen wurde.

+

Die Software versucht nun eine Verbindung mit dem Server aufzunehmen um Befehle für den Zugriff auf die Bürgerkarte zu erhalten.

+


+
+ +
+ + diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.welcome.png b/BKULocal/src/main/webapp/helpfiles/de/help.welcome.png new file mode 100644 index 00000000..0be05a78 Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.welcome.png differ diff --git a/BKULocal/src/main/webapp/helpfiles/help.css b/BKULocal/src/main/webapp/helpfiles/help.css new file mode 100644 index 00000000..28f9767b --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/help.css @@ -0,0 +1,81 @@ +@charset "UTF-8"; +body { + font: 100% Verdana, Arial, Helvetica, sans-serif; + background: #666666; + margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */ + padding: 0; + text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */ + color: #000000; +} + +/* Tips for Elastic layouts +1. Since the elastic layouts overall sizing is based on the user's default fonts size, they are more unpredictable. Used correctly, they are also more accessible for those that need larger fonts size since the line length remains proportionate. +2. Sizing of divs in this layout are based on the 100% font size in the body element. If you decrease the text size overall by using a font-size: 80% on the body element or the #container, remember that the entire layout will downsize proportionately. You may want to increase the widths of the various divs to compensate for this. +3. If font sizing is changed in differing amounts on each div instead of on the overall design (ie: #sidebar1 is given a 70% font size and #mainContent is given an 85% font size), this will proportionately change each of the divs overall size. You may want to adjust based on your final font sizing. +*/ +.twoColElsLtHdr #container { + width: 46em; /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */ + background: #FFFFFF; + margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */ + border: 1px solid #000000; + text-align: left; /* this overrides the text-align: center on the body element. */ +} +.twoColElsLtHdr #header { + background: #DDDDDD; + padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */ +} +.twoColElsLtHdr #header h1 { + margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */ + padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */ +} + +/* Tips for sidebar1: +1. Be aware that if you set a font-size value on this div, the overall width of the div will be adjusted accordingly. +2. Since we are working in ems, it's best not to use padding on the sidebar itself. It will be added to the width for standards compliant browsers creating an unknown actual width. +3. Space between the side of the div and the elements within it can be created by placing a left and right margin on those elements as seen in the ".twoColElsLtHdr #sidebar1 p" rule. +*/ +.twoColElsLtHdr #sidebar1 { + float: left; + width: 210px; + padding: 15px 0; /* top and bottom padding create visual space within this div */ + background-color: #FFFFFF; +} +.twoColElsLtHdr #sidebar1 h3, .twoColElsLtHdr #sidebar1 p { + margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */ + margin-right: 10px; +} + +/* Tips for mainContent: +1. If you give this #mainContent div a font-size value different than the #sidebar1 div, the margins of the #mainContent div will be based on its font-size and the width of the #sidebar1 div will be based on its font-size. You may wish to adjust the values of these divs. +2. The space between the mainContent and sidebar1 is created with the left margin on the mainContent div. No matter how much content the sidebar1 div contains, the column space will remain. You can remove this left margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. +3. To avoid float drop, you may need to test to determine the approximate maximum image/element size since this layout is based on the user's font sizing combined with the values you set. However, if the user has their browser font size set lower than normal, less space will be available in the #mainContent div than you may see on testing. +4. In the Internet Explorer Conditional Comment below, the zoom property is used to give the mainContent "hasLayout." This avoids several IE-specific bugs that may occur. +*/ +.twoColElsLtHdr #mainContent { + margin: 0 1.5em 0 15em; /* the right margin can be given in ems or pixels. It creates the space down the right side of the page. */ + padding: 0 10px; +} +.twoColElsLtHdr #footer { + padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */ + background:#DDDDDD; +} +.twoColElsLtHdr #footer p { + margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */ + padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */ +} + +/* Miscellaneous classes for reuse */ +.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ + float: right; + margin-left: 8px; +} +.fltlft { /* this class can be used to float an element left in your page */ + float: left; + margin-right: 8px; +} +.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */ + clear:both; + height:0; + font-size: 1px; + line-height: 0px; +} \ No newline at end of file diff --git a/BKULocal/src/main/webapp/helpfiles/index.html b/BKULocal/src/main/webapp/helpfiles/index.html new file mode 100644 index 00000000..49aaed66 --- /dev/null +++ b/BKULocal/src/main/webapp/helpfiles/index.html @@ -0,0 +1,17 @@ + + + + + + + + + +

Default help page if no help item is provided

+ + + diff --git a/BKUOnline/src/main/webapp/img/BackgroundChipperling.png b/BKUOnline/src/main/webapp/img/BackgroundChipperling.png new file mode 100644 index 00000000..5097aa6b Binary files /dev/null and b/BKUOnline/src/main/webapp/img/BackgroundChipperling.png differ diff --git a/BKUOnline/src/main/webapp/img/BackgroundMocca.png b/BKUOnline/src/main/webapp/img/BackgroundMocca.png new file mode 100644 index 00000000..349d9ff0 Binary files /dev/null and b/BKUOnline/src/main/webapp/img/BackgroundMocca.png differ -- cgit v1.2.3 From e77343708ec9b74aed7256d72982e4fce4be80d8 Mon Sep 17 00:00:00 2001 From: wbauer Date: Sat, 15 Nov 2008 10:34:45 +0000 Subject: Release 1.0 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@175 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/pom.xml | 14 +++++++------- BKUCommonGUI/pom.xml | 8 ++++---- BKULocal/pom.xml | 14 +++++++------- BKUOnline/pom.xml | 14 +++++++------- BKUOnline/src/main/webapp/appletPage.jsp | 2 +- BKUViewer/pom.xml | 6 +++--- STAL/pom.xml | 4 ++-- STALService/pom.xml | 6 +++--- bkucommon/pom.xml | 8 ++++---- pom.xml | 2 +- smcc/pom.xml | 4 ++-- smccSTAL/pom.xml | 10 +++++----- utils/pom.xml | 4 ++-- 13 files changed, 48 insertions(+), 48 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml index a20a613d..eaaa5820 100644 --- a/BKUApplet/pom.xml +++ b/BKUApplet/pom.xml @@ -3,13 +3,13 @@ bku at.gv.egiz - 1.0-SNAPSHOT + 1.0 4.0.0 at.gv.egiz BKUApplet BKU Applet - 1.0-SNAPSHOT + 1.0 @@ -116,27 +116,27 @@ at.gv.egiz smcc - 1.0-SNAPSHOT + 1.0 at.gv.egiz STAL - 1.0-SNAPSHOT + 1.0 at.gv.egiz STALService - 1.0-SNAPSHOT + 1.0 at.gv.egiz smccSTAL - 1.0-SNAPSHOT + 1.0 at.gv.egiz BKUCommonGUI - 1.0-SNAPSHOT + 1.0 commons-logging diff --git a/BKUCommonGUI/pom.xml b/BKUCommonGUI/pom.xml index 8c08ba6e..1aea89f6 100644 --- a/BKUCommonGUI/pom.xml +++ b/BKUCommonGUI/pom.xml @@ -3,23 +3,23 @@ bku at.gv.egiz - 1.0-SNAPSHOT + 1.0 4.0.0 at.gv.egiz BKUCommonGUI BKU Common GUI - 1.0-SNAPSHOT + 1.0 at.gv.egiz smcc - 1.0-SNAPSHOT + 1.0 at.gv.egiz STAL - 1.0-SNAPSHOT + 1.0 compile diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index 03a6a10b..36503ca0 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -3,7 +3,7 @@ bku at.gv.egiz - 1.0-SNAPSHOT + 1.0 4.0.0 at.gv.egiz @@ -57,22 +57,22 @@ at.gv.egiz STAL - 1.0-SNAPSHOT + 1.0 at.gv.egiz bkucommon - 1.0-SNAPSHOT + 1.0 at.gv.egiz smcc - 1.0-SNAPSHOT + 1.0 at.gv.egiz smccSTAL - 1.0-SNAPSHOT + 1.0 org.springframework @@ -97,12 +97,12 @@ at.gv.egiz BKUApplet - 1.0-SNAPSHOT + 1.0 at.gv.egiz BKUViewer - 1.0-SNAPSHOT + 1.0 diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index 5cdf5356..a1d92390 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -4,14 +4,14 @@ bku at.gv.egiz - 1.0-SNAPSHOT + 1.0 4.0.0 at.gv.egiz BKUOnline war BKU Online - 1.0-SNAPSHOT + 1.0 @@ -25,12 +25,12 @@ at.gv.egiz bkucommon - 1.0-SNAPSHOT + 1.0 at.gv.egiz BKUViewer - 1.0-SNAPSHOT + 1.0 commons-logging @@ -55,14 +55,14 @@ at.gv.egiz STALService - 1.0-SNAPSHOT + 1.0 compile at.gv.egiz BKUApplet - 1.0-SNAPSHOT + 1.0 provided + diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java index d661c71a..f68f2ece 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java @@ -87,8 +87,8 @@ public class BKUGUI implements BKUGUIFacade { * @param contentPane * @param localeString may be null */ - @Override - public void init(final Container contentPane, Locale locale, final URL background, ActionListener helpListener) { +// @Override + public void init(final Container contentPane, Locale locale, Style guiStyle, final URL background, ActionListener helpListener) { if (locale != null) { messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, locale); @@ -814,7 +814,7 @@ public class BKUGUI implements BKUGUIFacade { } @Override - public void showHashDataInputDialog(final List signedReferences, boolean standalone, final ActionListener okListener, final String okCommand) { + public void showHashDataInputDialog(final List signedReferences, final ActionListener okListener, final String okCommand) { if (signedReferences == null) { showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {"No SignedReferences provided"}, okListener, okCommand); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index 87982c79..2dbba730 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -91,7 +91,9 @@ public interface BKUGUIFacade { public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix"; public static final String ALT_HELP = "alt.help"; - public void init(Container contentPane, Locale locale, URL background, ActionListener helpListener); + public enum Style { simple, advanced }; + +// public void init(Container contentPane, Locale locale, Style guiStyle, URL background, ActionListener helpListener); /** * @@ -128,7 +130,7 @@ public interface BKUGUIFacade { * @param okListener * @param okCommand */ - public void showHashDataInputDialog(List signedReferences, boolean externalDisplay, ActionListener okListener, String okCommand); + public void showHashDataInputDialog(List signedReferences, ActionListener okListener, String okCommand); /** * TODO pull out from BKUGUIFacade. (or make this strictly an applet internal version) diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java index 87676026..f4981614 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java @@ -17,24 +17,29 @@ package at.gv.egiz.bku.gui; +import java.awt.Container; +import java.awt.event.ActionListener; +import java.net.URL; +import java.util.Locale; + public class BKUGUIFactory { public static final String SIMPLE_GUI = "simple"; public static final String ADVANCED_GUI = "advanced"; - private static BKUGUIFactory instance = new BKUGUIFactory(); +// private static BKUGUIFactory instance = new BKUGUIFactory(); - private BKUGUIFactory() { - } +// private BKUGUIFactory() { +// } +// +// protected BKUGUIFacade createNewGUI(Container contentPane, Locale locale, String style, URL background, ActionListener helpListener) { +// +// } - protected BKUGUIFacade createNewGUI(String style) { + public static BKUGUIFacade createGUI(Container contentPane, Locale locale, String style, URL background, ActionListener helpListener) { if (ADVANCED_GUI.equals(style)) { - return new BKUGUI(); + return new SimpleGUI(contentPane, locale, BKUGUIFacade.Style.advanced, background, helpListener); } - return new SimpleGUI(); - } - - public static BKUGUIFacade createGUI(String style) { - return instance.createNewGUI(style); + return new SimpleGUI(contentPane, locale, BKUGUIFacade.Style.simple, background, helpListener); } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java index ba968a48..f03bf158 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java @@ -17,6 +17,7 @@ package at.gv.egiz.bku.gui; import java.applet.AppletContext; +import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.util.Locale; import javax.swing.SwingUtilities; @@ -29,34 +30,56 @@ public class DefaultHelpListener extends AbstractHelpListener { protected AppletContext ctx; + /** + * + * @param ctx open external links via applet context + * @param helpURL + * @param locale + */ public DefaultHelpListener(AppletContext ctx, URL helpURL, Locale locale) { super(helpURL, locale); this.ctx = ctx; } + /** + * external links in help document are not opened + * @param helpURL + * @param locale + */ public DefaultHelpListener(URL helpURL, Locale locale) { super(helpURL, locale); this.ctx = null; } + /** + * blocks until help viewer returns (is closed) + * @param helpURL + * @param helpTopic + */ @Override - public void showDocument(final URL helpURL, final String helpTopic) throws Exception { - log.debug("schedule help dialog"); - - SwingUtilities.invokeLater(new Runnable() { + public void showDocument(final URL helpURL, final String helpTopic) { +// try { + log.debug("schedule help dialog"); + +// SwingUtilities.invokeAndWait(new Runnable() { + SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - + log.debug("show help dialog"); - + if (ctx == null) { HelpViewer.showHelpDialog(helpURL, helpTopic, messages); - } else { HelpViewer.showHelpDialog(ctx, helpURL, helpTopic, messages); } } }); +// } catch (InterruptedException ex) { +// log.error("Failed to display HelpViewer: " + ex.getMessage(), ex); +// } catch (InvocationTargetException ex) { +// log.error("Failed to display HelpViewer: " + ex.getMessage(), ex); +// } } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java index 31887bde..7b77faeb 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java @@ -16,7 +16,6 @@ */ package at.gv.egiz.bku.gui; -import at.gv.egiz.bku.gui.html.RestrictedHTMLEditorKit; import at.gv.egiz.stal.HashDataInput; import java.awt.Component; import java.awt.Container; @@ -49,11 +48,6 @@ import javax.swing.JScrollPane; import javax.swing.LayoutStyle; import javax.swing.text.Document; import javax.swing.text.EditorKit; -import javax.swing.text.Element; -import javax.swing.text.ViewFactory; -import javax.swing.text.html.HTML; -import javax.swing.text.html.HTMLEditorKit; -import javax.swing.text.html.ImageView; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java index 173254e7..0fef3f75 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java @@ -105,7 +105,7 @@ public class HelpViewer extends JDialog JPanel helpPanel = createViewerPanel(viewerLabel, helpURL); JPanel buttonPanel = createButtonPanel(); - initContentPane(new Dimension(600, 400), helpPanel, buttonPanel); + initContentPane(new Dimension(600, 600), helpPanel, buttonPanel); pack(); if (frame != null) { setLocationRelativeTo(frame); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java index bb568b75..d4d6efef 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java @@ -32,6 +32,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; import java.net.URL; import java.text.MessageFormat; import java.util.List; @@ -40,7 +41,6 @@ import java.util.ResourceBundle; import javax.swing.GroupLayout; import javax.swing.ImageIcon; import javax.swing.JButton; -import javax.swing.JCheckBox; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JOptionPane; @@ -51,7 +51,6 @@ import javax.swing.JTable; import javax.swing.JTextArea; import javax.swing.LayoutStyle; import javax.swing.SwingUtilities; -import javax.swing.table.TableColumn; import javax.swing.table.TableModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -69,38 +68,60 @@ public class SimpleGUI implements BKUGUIFacade { protected Container contentPane; protected ResourceBundle messages; /** left and right side main panels */ -// protected JPanel iconPanel; + protected JPanel iconPanel; protected JPanel contentPanel; /** right side content panels and layouts */ -// protected JPanel headerPanel; + protected JPanel headerPanel; protected JPanel mainPanel; protected JPanel buttonPanel; /** right side fixed labels */ -// protected JLabel titleLabel; + protected JLabel titleLabel; protected JLabel helpLabel; /** remember the pinfield to return to worker */ protected JPasswordField pinField; protected int buttonSize; -// private static final int CHECKBOX_WIDTH = new JCheckBox().getPreferredSize().width; + /** gui style config (default 'simple') */ + protected boolean renderHeaderPanel = false; + protected boolean renderIconPanel = false; + protected boolean renderCancelButton = false; /** + * set contentPane + * init message bundle + * configure the style + * register the help listener + * create GUI (on event-dispatching thread) + * * @param contentPane - * @param localeString may be null + * @param locale + * @param guiStyle + * @param background + * @param helpListener */ - @Override - public void init(final Container contentPane, Locale locale, final URL background, ActionListener helpListener) { + public SimpleGUI(Container contentPane, Locale locale, Style guiStyle, URL background, ActionListener helpListener) { + this.contentPane = contentPane; - if (locale != null) { - messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, locale); - } else { - messages = ResourceBundle.getBundle(MESSAGES_BUNDLE); - } + if (locale != null) { + messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, locale); + } else { + messages = ResourceBundle.getBundle(MESSAGES_BUNDLE); + } + + if (guiStyle == Style.advanced) { + renderHeaderPanel = true; + renderIconPanel = false; + renderCancelButton = true; + } + + registerHelpListener(helpListener); + + createGUI(background); + } + + private void createGUI(final URL background) { - this.contentPane = contentPane; - registerHelpListener(helpListener); - try { log.debug("scheduling gui initialization"); @@ -112,21 +133,28 @@ public class SimpleGUI implements BKUGUIFacade { log.debug("initializing gui"); -// initIconPanel(); + if (renderIconPanel) { + initIconPanel(background); + initContentPanel(null); + } else { initContentPanel(background); - - GroupLayout layout = new GroupLayout(contentPane); - contentPane.setLayout(layout); + } + + GroupLayout layout = new GroupLayout(contentPane); + contentPane.setLayout(layout); + + if (renderIconPanel) { + layout.setHorizontalGroup(layout.createSequentialGroup() + .addComponent(iconPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); + layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(iconPanel, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); + } else { layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(contentPanel)); layout.setVerticalGroup(layout.createSequentialGroup().addComponent(contentPanel)); -// layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) -// .addGroup(layout.createSequentialGroup() -// .addComponent(iconPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); -// layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING) -// .addComponent(iconPanel, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) -// .addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); + } } }); } catch (Exception ex) { @@ -134,119 +162,113 @@ public class SimpleGUI implements BKUGUIFacade { } } -// protected void initIconPanel() { -// iconPanel = new JPanel(); -// JLabel iconLabel = new JLabel(); -// iconLabel.setIcon(new ImageIcon(getClass().getResource(LOGO_RESOURCE))); // NOI18N -// -// GroupLayout iconPanelLayout = new GroupLayout(iconPanel); -// iconPanel.setLayout(iconPanelLayout); -// iconPanelLayout.setHorizontalGroup( -// iconPanelLayout.createSequentialGroup() -// .addContainerGap() -// .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, iconLabel.getPreferredSize().width, GroupLayout.PREFERRED_SIZE) -// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //); -// iconPanelLayout.setVerticalGroup( -// iconPanelLayout.createSequentialGroup() -// .addContainerGap() -// .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, iconLabel.getPreferredSize().height, GroupLayout.PREFERRED_SIZE) -// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //); -// } + protected void initIconPanel(URL background) { + if (background == null) { + background = getClass().getResource(DEFAULT_BACKGROUND); + } + if ("file".equals(background.getProtocol())) { + log.warn("file:// background images not permitted: " + background); + background = getClass().getResource(DEFAULT_BACKGROUND); + } + log.debug("loading icon panel background " + background); + + iconPanel = new JPanel(); + JLabel iconLabel = new JLabel(); + iconLabel.setIcon(new ImageIcon(background)); + + GroupLayout iconPanelLayout = new GroupLayout(iconPanel); + iconPanel.setLayout(iconPanelLayout); + iconPanelLayout.setHorizontalGroup( + iconPanelLayout.createSequentialGroup() + .addContainerGap() + .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); + // no gap here (contentPanel has containerGap) + iconPanelLayout.setVerticalGroup( + iconPanelLayout.createSequentialGroup() + .addContainerGap() + .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); + } protected void initContentPanel(URL background) { if (background == null) { - background = this.getClass().getResource(DEFAULT_BACKGROUND); + background = getClass().getResource(DEFAULT_BACKGROUND); } if ("file".equals(background.getProtocol())) { - log.warn("local background image not allowed: " + background); - background = this.getClass().getResource(DEFAULT_BACKGROUND); + log.warn("file:// background images not permitted: " + background); + background = getClass().getResource(DEFAULT_BACKGROUND); } log.debug("loading background " + background); contentPanel = new ImagePanel(background); -// contentPanel.setBorder(new TitledBorder("content")); - -// headerPanel = new JPanel(); -// headerPanel.setOpaque(false); - mainPanel = new JPanel(); - mainPanel.setOpaque(false); - buttonPanel = new JPanel(); - buttonPanel.setOpaque(false); - -// headerPanel.setBorder(new TitledBorder("header")); -// mainPanel.setBorder(new TitledBorder("main")); -// buttonPanel.setBorder(new TitledBorder("button")); - -// titleLabel = new JLabel(); -// titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() | -// java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2)); - - helpLabel = new JLabel(); - helpLabel.setIcon(new ImageIcon(getClass().getResource(HELP_IMG))); - helpLabel.getAccessibleContext().setAccessibleName(messages.getString(ALT_HELP)); - helpLabel.addMouseListener(helpListener); - helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - - JButton b = new JButton(); -// b.setText(messages.getString(BUTTON_CANCEL)); -// if (b.getPreferredSize().width > buttonSize) -// buttonSize = b.getPreferredSize().width; - b.setText(messages.getString(BUTTON_OK)); - if (b.getPreferredSize().width > buttonSize) - buttonSize = b.getPreferredSize().width; - b.setText(messages.getString(BUTTON_SIGN)); - if (b.getPreferredSize().width > buttonSize) - buttonSize = b.getPreferredSize().width; - b.setText(messages.getString(BUTTON_BACK)); - if (b.getPreferredSize().width > buttonSize) - buttonSize = b.getPreferredSize().width; -// b.setText(messages.getString(BUTTON_SAVE)); -// if (b.getPreferredSize().width > buttonSize) -// buttonSize = b.getPreferredSize().width; - -// if (cancelButton.getPreferredSize().width > buttonSize) -// buttonSize = cancelButton.getPreferredSize().width; -// if (signButton.getPreferredSize().width > buttonSize) -// buttonSize = signButton.getPreferredSize().width; -// if (backButton.getPreferredSize().width > buttonSize) -// buttonSize = backButton.getPreferredSize().width; -// if (saveButton.getPreferredSize().width > buttonSize) -// buttonSize = saveButton.getPreferredSize().width; + mainPanel = new JPanel(); + mainPanel.setOpaque(false); + buttonPanel = new JPanel(); + buttonPanel.setOpaque(false); + helpLabel = new JLabel(); + helpLabel.setIcon(new ImageIcon(getClass().getResource(HELP_IMG))); + helpLabel.getAccessibleContext().setAccessibleName(messages.getString(ALT_HELP)); + helpLabel.addMouseListener(helpListener); + helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + + buttonSize = initButtonSize(messages, renderCancelButton); -// GroupLayout headerPanelLayout = new GroupLayout(headerPanel); -// headerPanel.setLayout(headerPanelLayout); -// -// headerPanelLayout.setHorizontalGroup( -// headerPanelLayout.createSequentialGroup() -// .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); -// headerPanelLayout.setVerticalGroup( -// headerPanelLayout.createSequentialGroup() -// .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)); - - - GroupLayout contentPanelLayout = new GroupLayout(contentPanel); - contentPanel.setLayout(contentPanelLayout); - - contentPanelLayout.setHorizontalGroup( - contentPanelLayout.createSequentialGroup() - .addContainerGap() - .addGroup( - contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) -// .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addContainerGap()); - contentPanelLayout.setVerticalGroup( - contentPanelLayout.createSequentialGroup() - .addContainerGap() -// .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) //, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addContainerGap()); + if (renderHeaderPanel) { + headerPanel = new JPanel(); + headerPanel.setOpaque(false); + + titleLabel = new JLabel(); + titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() | + java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2)); + + GroupLayout headerPanelLayout = new GroupLayout(headerPanel); + headerPanel.setLayout(headerPanelLayout); + + headerPanelLayout.setHorizontalGroup( + headerPanelLayout.createSequentialGroup() + .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel)); + headerPanelLayout.setVerticalGroup( + headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) + .addComponent(helpLabel)); + } + + GroupLayout contentPanelLayout = new GroupLayout(contentPanel); + contentPanel.setLayout(contentPanelLayout); + + GroupLayout.ParallelGroup horizontalContentInner = contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); + if (renderHeaderPanel) { + horizontalContentInner + .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE); + } + horizontalContentInner + .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE); + GroupLayout.SequentialGroup horizontalContentOuter = contentPanelLayout.createSequentialGroup(); + if (!renderIconPanel) { + horizontalContentOuter + .addContainerGap(); + } + horizontalContentOuter + .addGroup(horizontalContentInner) + .addContainerGap(); + contentPanelLayout.setHorizontalGroup(horizontalContentOuter); + + GroupLayout.SequentialGroup verticalContent = contentPanelLayout.createSequentialGroup(); + verticalContent.addContainerGap(); + if (renderHeaderPanel) { + verticalContent.addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); + } + verticalContent.addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addContainerGap(); + contentPanelLayout.setVerticalGroup(verticalContent); } @Override @@ -269,26 +291,35 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.removeAll(); buttonPanel.removeAll(); -// titleLabel.setText(messages.getString(TITLE_WELCOME)); - helpListener.setHelpTopic(HELP_WELCOME); JLabel welcomeMsgLabel = new JLabel(); welcomeMsgLabel.setFont(welcomeMsgLabel.getFont().deriveFont(welcomeMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - welcomeMsgLabel.setText(messages.getString(TITLE_WELCOME)); - + + if (renderHeaderPanel) { + titleLabel.setText(messages.getString(TITLE_WELCOME)); + welcomeMsgLabel.setText(messages.getString(MESSAGE_WAIT)); + } else { + welcomeMsgLabel.setText(messages.getString(TITLE_WELCOME)); + } + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() - .addComponent(welcomeMsgLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel)); - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(welcomeMsgLabel) - .addComponent(helpLabel)); + GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup() + .addComponent(welcomeMsgLabel); + GroupLayout.Group messageVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(welcomeMsgLabel); + if (!renderHeaderPanel) { + messageHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel); + messageVertical + .addComponent(helpLabel); + } + + mainPanelLayout.setHorizontalGroup(messageHorizontal); + mainPanelLayout.setVerticalGroup(messageVertical); contentPanel.validate(); @@ -311,8 +342,10 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.removeAll(); buttonPanel.removeAll(); -// titleLabel.setText(messages.getString(TITLE_INSERTCARD)); - + if (renderHeaderPanel) { + titleLabel.setText(messages.getString(TITLE_INSERTCARD)); + } + helpListener.setHelpTopic(HELP_INSERTCARD); JLabel insertCardMsgLabel = new JLabel(); @@ -322,31 +355,39 @@ public class SimpleGUI implements BKUGUIFacade { GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() - .addComponent(insertCardMsgLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel)); - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(insertCardMsgLabel) - .addComponent(helpLabel)); + GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup() + .addComponent(insertCardMsgLabel); + GroupLayout.ParallelGroup messageVertical = mainPanelLayout.createParallelGroup() + .addComponent(insertCardMsgLabel); -// JButton cancelButton = new JButton(); -// cancelButton.setText(messages.getString(BUTTON_CANCEL)); -// cancelButton.addActionListener(cancelListener); -// cancelButton.setActionCommand(cancelCommand); -// -// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); -// buttonPanel.setLayout(buttonPanelLayout); -// -// buttonPanelLayout.setHorizontalGroup( -// buttonPanelLayout.createSequentialGroup() -// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) -// .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); -// buttonPanelLayout.setVerticalGroup( -// buttonPanelLayout.createSequentialGroup() -// .addComponent(cancelButton)); + if (!renderHeaderPanel) { + messageHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel); + messageVertical + .addComponent(helpLabel); + } + + mainPanelLayout.setHorizontalGroup(messageHorizontal); + mainPanelLayout.setVerticalGroup(messageVertical); + + if (renderCancelButton) { + JButton cancelButton = new JButton(); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.addActionListener(cancelListener); + cancelButton.setActionCommand(cancelCommand); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createSequentialGroup() + .addComponent(cancelButton)); + } contentPanel.validate(); } @@ -373,48 +414,89 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.removeAll(); buttonPanel.removeAll(); -// titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED)); + JLabel insertCardMsgLabel = new JLabel(); + insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + + if (renderHeaderPanel) { + titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED)); + insertCardMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD)); + } else { + insertCardMsgLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED)); + } helpListener.setHelpTopic(HELP_CARDNOTSUPPORTED); - JLabel insertCardMsgLabel = new JLabel(); - insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - insertCardMsgLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED)); + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup() + .addComponent(insertCardMsgLabel); + GroupLayout.Group messageVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(insertCardMsgLabel); + if (!renderHeaderPanel) { + messageHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel); + messageVertical + .addComponent(helpLabel); + } + + mainPanelLayout.setHorizontalGroup(messageHorizontal); + mainPanelLayout.setVerticalGroup(messageVertical); + + if (renderCancelButton) { + JButton cancelButton = new JButton(); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.addActionListener(cancelListener); + cancelButton.setActionCommand(cancelCommand); - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() - .addComponent(insertCardMsgLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel)); - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(insertCardMsgLabel) - .addComponent(helpLabel)); - -// JButton cancelButton = new JButton(); -// cancelButton.setText(messages.getString(BUTTON_CANCEL)); -// cancelButton.addActionListener(cancelListener); -// cancelButton.setActionCommand(cancelCommand); -// -// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); -// buttonPanel.setLayout(buttonPanelLayout); -// -// buttonPanelLayout.setHorizontalGroup( -// buttonPanelLayout.createSequentialGroup() -// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) -// .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); -// buttonPanelLayout.setVerticalGroup( -// buttonPanelLayout.createSequentialGroup() -// .addComponent(cancelButton)); - - contentPanel.validate(); + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createSequentialGroup() + .addComponent(cancelButton)); + } + + contentPanel.validate(); } }); } + private static int initButtonSize(ResourceBundle messages, boolean renderCancelButton) { + + int buttonSize = 0; + + JButton b = new JButton(); + b.setText(messages.getString(BUTTON_OK)); + if (b.getPreferredSize().width > buttonSize) { + buttonSize = b.getPreferredSize().width; + } + b.setText(messages.getString(BUTTON_SIGN)); + if (b.getPreferredSize().width > buttonSize) { + buttonSize = b.getPreferredSize().width; + } + b.setText(messages.getString(BUTTON_BACK)); + if (b.getPreferredSize().width > buttonSize) { + buttonSize = b.getPreferredSize().width; + } + b.setText(messages.getString(BUTTON_SAVE)); + if (b.getPreferredSize().width > buttonSize) { + buttonSize = b.getPreferredSize().width; + } + if (renderCancelButton) { + b.setText(messages.getString(BUTTON_CANCEL)); + if (b.getPreferredSize().width > buttonSize) { + buttonSize = b.getPreferredSize().width; + } + } + return buttonSize; + } + private void showCardPINDialog(final PINSpec pinSpec, final int numRetries, final ActionListener okListener, final String okCommand, final ActionListener cancelListener, final String cancelCommand) { log.debug("scheduling card-pin dialog"); @@ -429,17 +511,14 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.removeAll(); buttonPanel.removeAll(); -// if (numRetries < 0) { -// String cardpinTitle = messages.getString(TITLE_CARDPIN); -// titleLabel.setText(MessageFormat.format(cardpinTitle, new Object[]{pinSpec.getLocalizedName()})); -// } else { -// titleLabel.setText(messages.getString(TITLE_RETRY)); -// } - -// JButton cancelButton = new JButton(); -// cancelButton.setText(messages.getString(BUTTON_CANCEL)); -// cancelButton.setActionCommand(cancelCommand); -// cancelButton.addActionListener(cancelListener); + if (renderHeaderPanel) { + if (numRetries < 0) { + String cardpinTitle = messages.getString(TITLE_CARDPIN); + titleLabel.setText(MessageFormat.format(cardpinTitle, new Object[]{pinSpec.getLocalizedName()})); + } else { + titleLabel.setText(messages.getString(TITLE_RETRY)); + } + } JButton okButton = new JButton(); okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD)); @@ -492,55 +571,73 @@ public class SimpleGUI implements BKUGUIFacade { GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addGroup(mainPanelLayout.createSequentialGroup() + GroupLayout.ParallelGroup mainHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); + GroupLayout.SequentialGroup pinHorizontal = mainPanelLayout.createSequentialGroup() .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //)) - .addComponent(pinsizeLabel)))); - - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(infoLabel) - .addComponent(helpLabel)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(cardPinLabel) - .addComponent(pinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinsizeLabel)); + .addComponent(pinsizeLabel)); + + GroupLayout.SequentialGroup mainVertical = mainPanelLayout.createSequentialGroup(); + + if (!renderHeaderPanel) { + GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup() + .addComponent(infoLabel) //, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel); //, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + mainHorizontal + .addGroup(infoHorizontal) + .addGroup(pinHorizontal); + GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(infoLabel) + .addComponent(helpLabel); + mainVertical + .addGroup(infoVertical) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); + } else { + mainHorizontal + .addGroup(pinHorizontal); + } + mainVertical + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(cardPinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel); + + mainPanelLayout.setHorizontalGroup(mainHorizontal); + mainPanelLayout.setVerticalGroup(mainVertical); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); - buttonPanelLayout.setHorizontalGroup( - buttonPanelLayout.createSequentialGroup() + GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); - buttonPanelLayout.setVerticalGroup( - buttonPanelLayout.createSequentialGroup() - .addComponent(okButton)); - -// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); -// buttonPanel.setLayout(buttonPanelLayout); -// -// buttonPanelLayout.setHorizontalGroup( -// buttonPanelLayout.createSequentialGroup() -// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) -// .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); -// buttonPanelLayout.setVerticalGroup( -// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) -// .addComponent(okButton) -// .addComponent(cancelButton)); + .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + GroupLayout.Group buttonVertical; + + if (renderCancelButton) { + JButton cancelButton = new JButton(); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.setActionCommand(cancelCommand); + cancelButton.addActionListener(cancelListener); + + buttonHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(okButton) + .addComponent(cancelButton); + } else { + buttonVertical = buttonPanelLayout.createSequentialGroup() + .addComponent(okButton); + } + + buttonPanelLayout.setHorizontalGroup(buttonHorizontal); + buttonPanelLayout.setVerticalGroup(buttonVertical); pinField.requestFocusInWindow(); contentPanel.validate(); @@ -583,16 +680,13 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.removeAll(); buttonPanel.removeAll(); -// if (numRetries < 0) { -// titleLabel.setText(messages.getString(TITLE_SIGN)); -// } else { -// titleLabel.setText(messages.getString(TITLE_RETRY)); -// } - -// JButton cancelButton = new JButton(); -// cancelButton.setText(messages.getString(BUTTON_CANCEL)); -// cancelButton.setActionCommand(cancelCommand); -// cancelButton.addActionListener(cancelListener); + if (renderHeaderPanel) { + if (numRetries < 0) { + titleLabel.setText(messages.getString(TITLE_SIGN)); + } else { + titleLabel.setText(messages.getString(TITLE_RETRY)); + } + } JButton signButton = new JButton(); signButton.setFont(signButton.getFont().deriveFont(signButton.getFont().getStyle() & ~java.awt.Font.BOLD)); @@ -653,13 +747,23 @@ public class SimpleGUI implements BKUGUIFacade { GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); + + GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup() + .addComponent(infoLabel); + GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(infoLabel); + + if (!renderHeaderPanel) { + infoHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel); //, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); + infoVertical + .addComponent(helpLabel); + } mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addGroup(infoHorizontal) .addGroup(mainPanelLayout.createSequentialGroup() .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) @@ -669,9 +773,7 @@ public class SimpleGUI implements BKUGUIFacade { mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(infoLabel) - .addComponent(helpLabel)) + .addGroup(infoVertical) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(signPinLabel) @@ -682,27 +784,31 @@ public class SimpleGUI implements BKUGUIFacade { GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); - buttonPanelLayout.setHorizontalGroup( - buttonPanelLayout.createSequentialGroup() + GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(signButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); - buttonPanelLayout.setVerticalGroup( - buttonPanelLayout.createSequentialGroup() - .addComponent(signButton)); - -// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); -// buttonPanel.setLayout(buttonPanelLayout); -// -// buttonPanelLayout.setHorizontalGroup( -// buttonPanelLayout.createSequentialGroup() -// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) -// .addComponent(signButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); -// buttonPanelLayout.setVerticalGroup( -// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) -// .addComponent(signButton) -// .addComponent(cancelButton)); + .addComponent(signButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + GroupLayout.Group buttonVertical; + + if (renderCancelButton) { + JButton cancelButton = new JButton(); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.setActionCommand(cancelCommand); + cancelButton.addActionListener(cancelListener); + + buttonHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + + buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(signButton) + .addComponent(cancelButton); + } else { + buttonVertical = buttonPanelLayout.createSequentialGroup() + .addComponent(signButton); + } + + buttonPanelLayout.setHorizontalGroup(buttonHorizontal); + buttonPanelLayout.setVerticalGroup(buttonVertical); pinField.requestFocusInWindow(); contentPanel.validate(); @@ -726,15 +832,12 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.removeAll(); buttonPanel.removeAll(); -// titleLabel.setText(messages.getString(TITLE_ERROR)); + if (renderHeaderPanel) { + titleLabel.setText(messages.getString(TITLE_ERROR)); + } helpListener.setHelpTopic(errorMsgKey); - JLabel errorTitleLabel = new JLabel(); - errorTitleLabel.setFont(errorTitleLabel.getFont().deriveFont(errorTitleLabel.getFont().getStyle() | java.awt.Font.BOLD)); - errorTitleLabel.setText(messages.getString(TITLE_ERROR)); - errorTitleLabel.setForeground(ERROR_COLOR); - String errorMsgPattern = messages.getString(errorMsgKey); String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams); @@ -745,19 +848,30 @@ public class SimpleGUI implements BKUGUIFacade { GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(errorTitleLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel)) - .addComponent(errorMsgLabel)); - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(errorTitleLabel) - .addComponent(helpLabel)) - .addComponent(errorMsgLabel)); + GroupLayout.ParallelGroup mainHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); + GroupLayout.SequentialGroup mainVertical = mainPanelLayout.createSequentialGroup(); + + if (!renderHeaderPanel) { + JLabel errorTitleLabel = new JLabel(); + errorTitleLabel.setFont(errorTitleLabel.getFont().deriveFont(errorTitleLabel.getFont().getStyle() | java.awt.Font.BOLD)); + errorTitleLabel.setText(messages.getString(TITLE_ERROR)); + errorTitleLabel.setForeground(ERROR_COLOR); + + mainHorizontal + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(errorTitleLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel)); + mainVertical + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(errorTitleLabel) + .addComponent(helpLabel)); + } + + mainPanelLayout.setHorizontalGroup(mainHorizontal + .addComponent(errorMsgLabel)); + mainPanelLayout.setVerticalGroup(mainVertical + .addComponent(errorMsgLabel)); JButton okButton = new JButton(); okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD)); @@ -796,15 +910,12 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.removeAll(); buttonPanel.removeAll(); -// titleLabel.setText(messages.getString(TITLE_ERROR)); + if (renderHeaderPanel) { + titleLabel.setText(messages.getString(TITLE_ERROR)); + } helpListener.setHelpTopic(errorMsgKey); - JLabel errorTitleLabel = new JLabel(); - errorTitleLabel.setFont(errorTitleLabel.getFont().deriveFont(errorTitleLabel.getFont().getStyle() | java.awt.Font.BOLD)); - errorTitleLabel.setText(messages.getString(TITLE_ERROR)); - errorTitleLabel.setForeground(ERROR_COLOR); - String errorMsgPattern = messages.getString(errorMsgKey); String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams); @@ -815,20 +926,32 @@ public class SimpleGUI implements BKUGUIFacade { GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + + GroupLayout.ParallelGroup mainHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); + GroupLayout.SequentialGroup mainVertical = mainPanelLayout.createSequentialGroup(); + + if (!renderHeaderPanel) { + JLabel errorTitleLabel = new JLabel(); + errorTitleLabel.setFont(errorTitleLabel.getFont().deriveFont(errorTitleLabel.getFont().getStyle() | java.awt.Font.BOLD)); + errorTitleLabel.setText(messages.getString(TITLE_ERROR)); + errorTitleLabel.setForeground(ERROR_COLOR); + + mainHorizontal .addGroup(mainPanelLayout.createSequentialGroup() .addComponent(errorTitleLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel)) - .addComponent(errorMsgLabel)); - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() + .addComponent(helpLabel)); + mainVertical .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(errorTitleLabel) - .addComponent(helpLabel)) - .addComponent(errorMsgLabel)); + .addComponent(helpLabel)); + } + mainPanelLayout.setHorizontalGroup(mainHorizontal + .addComponent(errorMsgLabel)); + mainPanelLayout.setVerticalGroup(mainVertical + .addComponent(errorMsgLabel)); + contentPanel.validate(); } }); @@ -849,8 +972,10 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.removeAll(); buttonPanel.removeAll(); -// titleLabel.setText(messages.getString(TITLE_WAIT)); - + if (renderHeaderPanel) { + titleLabel.setText(messages.getString(TITLE_WAIT)); + } + helpListener.setHelpTopic(HELP_WAIT); JLabel waitMsgLabel = new JLabel(); @@ -864,15 +989,20 @@ public class SimpleGUI implements BKUGUIFacade { GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createSequentialGroup() - .addComponent(waitMsgLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel)); - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(waitMsgLabel) - .addComponent(helpLabel)); + GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup() + .addComponent(waitMsgLabel); + GroupLayout.ParallelGroup messageVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(waitMsgLabel); + + if (!renderHeaderPanel) { + messageHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel); + messageVertical + .addComponent(helpLabel); + } + mainPanelLayout.setHorizontalGroup(messageHorizontal); + mainPanelLayout.setVerticalGroup(messageVertical); contentPanel.validate(); } @@ -887,50 +1017,58 @@ public class SimpleGUI implements BKUGUIFacade { return null; } + /** + * TODO handle multiple references in HashDataViewer + * @param signedReferences + * @param okListener + * @param okCommand + */ @Override - public void showHashDataInputDialog(final List signedReferences, boolean standalone, final ActionListener okListener, final String okCommand) { + public void showHashDataInputDialog(final List signedReferences, final ActionListener okListener, final String okCommand) { if (signedReferences == null) { showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {"No SignedReferences provided"}, okListener, okCommand); + return; } + ActionListener saveHashDataListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + showSaveHashDataInputDialog(signedReferences, okListener, okCommand); + } + }; + if (signedReferences.size() == 1) { - if (standalone) { - ActionListener saveHashDataListener = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - showSaveHashDataInputDialog(signedReferences, okListener, okCommand); - } - }; - showHashDataViewer(signedReferences, saveHashDataListener, "save"); +// if (standalone) { - } else { - if ("text/plain".equals(signedReferences.get(0).getMimeType())) { - - ActionListener saveHashDataListener = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - showSaveHashDataInputDialog(signedReferences, okListener, okCommand); - } - }; - - try { - String hashDataText = getText(signedReferences.get(0)); - showPlainTextHashDataInputDialog(hashDataText, saveHashDataListener, "save", okListener, okCommand); - } catch (IOException ex) { - showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {ex.getMessage()}, okListener, okCommand); - } + showHashDataViewer(signedReferences, saveHashDataListener, "save"); - } else { - showSaveHashDataInputDialog(signedReferences, okListener, okCommand); - } - } +// } else { +// if ("text/plain".equals(signedReferences.get(0).getMimeType())) { +// +// ActionListener saveHashDataListener = new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent e) { +// showSaveHashDataInputDialog(signedReferences, okListener, okCommand); +// } +// }; +// +// try { +// String hashDataText = getText(signedReferences.get(0)); +// showPlainTextHashDataInputDialog(hashDataText, saveHashDataListener, "save", okListener, okCommand); +// } catch (IOException ex) { +// showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {ex.getMessage()}, okListener, okCommand); +// } +// +// } else { +// showSaveHashDataInputDialog(signedReferences, okListener, okCommand); +// } +// } } else { - SimpleHashDataTableModel tableModel = new SimpleHashDataTableModel(signedReferences); // final HashDataTableModel tableModel = new HashDataTableModel(signedReferences); // // ActionListener saveHashDataListener = new ActionListener() { @@ -940,128 +1078,112 @@ public class SimpleGUI implements BKUGUIFacade { // showSaveHashDataInputDialog(tableModel.getSelectedHashData(), okListener, okCommand); // } // }; - showMultipleHashDataInputDialog(tableModel, okListener, okCommand); + + SimpleHashDataTableModel tableModel = new SimpleHashDataTableModel(signedReferences); + showMultipleHashDataInputDialog(tableModel, okListener, okCommand, saveHashDataListener, "save"); } } /** - * TODO + * blocks until dialog returns (is closed) * @param hashDataText * @param saveListener * @param saveCommand */ private void showHashDataViewer(final List signedReferences, final ActionListener saveListener, final String saveCommand) { - log.debug("scheduling plaintext hashdatainput dialog"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - log.debug("show plaintext hashdatainput dialog"); - - ActionListener l = helpListener.getActionListener(); - HashDataViewer.showHashDataInput(contentPane, signedReferences, messages, saveListener, saveCommand, l); - } - }); - } - - private void showPlainTextHashDataInputDialog(final String hashDataText, final ActionListener saveListener, final String saveCommand, final ActionListener cancelListener, final String cancelCommand) { - - log.debug("scheduling plaintext hashdatainput dialog"); - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - log.debug("show plaintext hashdatainput dialog"); - - mainPanel.removeAll(); - buttonPanel.removeAll(); - -// titleLabel.setText(messages.getString(TITLE_HASHDATA)); - - helpListener.setHelpTopic(HELP_HASHDATA); - - JLabel refIdLabel = new JLabel(); - refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - refIdLabel.setText(messages.getString(MESSAGE_HASHDATA)); //MessageFormat.format(refIdLabelPattern, new Object[]{refId})); - - JTextArea hashDataTextArea = new JTextArea(hashDataText); - hashDataTextArea.setEditable(false); -// hashDataTextArea.setColumns(1); -// hashDataTextArea.setRows(1); - hashDataTextArea.setFont(new Font(HASHDATA_FONT, hashDataTextArea.getFont().getStyle(), hashDataTextArea.getFont().getSize())); -// hashDataScrollPane.setViewportView(hashDataTextArea); -// hashDataScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); //HORIZONTAL_SCROLLBAR_NEVER); - hashDataTextArea.setLineWrap(true); - hashDataTextArea.setWrapStyleWord(true); - - JScrollPane hashDataScrollPane = new JScrollPane(hashDataTextArea); - - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(refIdLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel)) - .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); - - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(refIdLabel) - .addComponent(helpLabel)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); - - JButton backButton = new JButton(); - backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - backButton.setText(messages.getString(BUTTON_BACK)); - backButton.setActionCommand(cancelCommand); - backButton.addActionListener(cancelListener); + try { + log.debug("scheduling plaintext hashdatainput dialog"); -// JButton saveButton = new JButton(); -// saveButton.setText(messages.getString(BUTTON_SAVE)); -// saveButton.setActionCommand(saveCommand); -// saveButton.addActionListener(saveListener); + SwingUtilities.invokeAndWait(new Runnable() { - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); + @Override + public void run() { - buttonPanelLayout.setHorizontalGroup( - buttonPanelLayout.createSequentialGroup() - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); - buttonPanelLayout.setVerticalGroup( - buttonPanelLayout.createSequentialGroup() - .addComponent(backButton)); + log.debug("show plaintext hashdatainput dialog"); + ActionListener l = helpListener.getActionListener(); + HashDataViewer.showHashDataInput(contentPane, signedReferences, messages, saveListener, saveCommand, l); + } + }); + + } catch (InterruptedException ex) { + log.error("Failed to display HashDataViewer: " + ex.getMessage()); + } catch (InvocationTargetException ex) { + log.error("Failed to display HashDataViewer: " + ex.getMessage()); + } + } + +// private void showPlainTextHashDataInputDialog(final String hashDataText, final ActionListener saveListener, final String saveCommand, final ActionListener cancelListener, final String cancelCommand) { +// +// log.debug("scheduling plaintext hashdatainput dialog"); +// +// SwingUtilities.invokeLater(new Runnable() { +// +// @Override +// public void run() { +// +// log.debug("show plaintext hashdatainput dialog"); +// +// mainPanel.removeAll(); +// buttonPanel.removeAll(); +// +// helpListener.setHelpTopic(HELP_HASHDATA); +// +// JLabel refIdLabel = new JLabel(); +// refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); +// refIdLabel.setText(messages.getString(MESSAGE_HASHDATA)); //MessageFormat.format(refIdLabelPattern, new Object[]{refId})); +// +// JTextArea hashDataTextArea = new JTextArea(hashDataText); +// hashDataTextArea.setEditable(false); +// hashDataTextArea.setFont(new Font(HASHDATA_FONT, hashDataTextArea.getFont().getStyle(), hashDataTextArea.getFont().getSize())); +// hashDataTextArea.setLineWrap(true); +// hashDataTextArea.setWrapStyleWord(true); +// +// JScrollPane hashDataScrollPane = new JScrollPane(hashDataTextArea); +// +// GroupLayout mainPanelLayout = new GroupLayout(mainPanel); +// mainPanel.setLayout(mainPanelLayout); +// +// mainPanelLayout.setHorizontalGroup( +// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) +// .addGroup(mainPanelLayout.createSequentialGroup() +// .addComponent(refIdLabel) +// .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) +// .addComponent(helpLabel)) +// .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); +// +// mainPanelLayout.setVerticalGroup( +// mainPanelLayout.createSequentialGroup() +// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) +// .addComponent(refIdLabel) +// .addComponent(helpLabel)) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)); +// +// JButton backButton = new JButton(); +// backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD)); +// backButton.setText(messages.getString(BUTTON_BACK)); +// backButton.setActionCommand(cancelCommand); +// backButton.addActionListener(cancelListener); +// // GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); // buttonPanel.setLayout(buttonPanelLayout); // // buttonPanelLayout.setHorizontalGroup( // buttonPanelLayout.createSequentialGroup() // .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) -// .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) // .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); // buttonPanelLayout.setVerticalGroup( -// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) -// .addComponent(saveButton) -// .addComponent(backButton)); - - contentPanel.validate(); - } - }); - } +// buttonPanelLayout.createSequentialGroup() +// .addComponent(backButton)); +// +// contentPanel.validate(); +// } +// }); +// } - private void showMultipleHashDataInputDialog(final TableModel signedReferences, final ActionListener cancelListener, final String cancelCommand) { -// , final ActionListener saveListener, final String saveCommand + private void showMultipleHashDataInputDialog(final TableModel signedReferences, final ActionListener cancelListener, final String cancelCommand, final ActionListener saveListener, final String saveCommand) { log.debug("scheduling multiple hashdatainput dialog"); @@ -1075,8 +1197,10 @@ public class SimpleGUI implements BKUGUIFacade { mainPanel.removeAll(); buttonPanel.removeAll(); -// titleLabel.setText(messages.getString(TITLE_HASHDATA)); - + if (renderHeaderPanel) { + titleLabel.setText(messages.getString(TITLE_HASHDATA)); + } + helpListener.setHelpTopic(HELP_HASHDATALIST); JLabel refIdLabel = new JLabel(); @@ -1124,36 +1248,31 @@ public class SimpleGUI implements BKUGUIFacade { backButton.setActionCommand(cancelCommand); backButton.addActionListener(cancelListener); -// JButton saveButton = new JButton(); -// saveButton.setText(messages.getString(BUTTON_SAVE)); -// saveButton.setActionCommand(saveCommand); -// saveButton.addActionListener(saveListener); - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); - buttonPanelLayout.setHorizontalGroup( - buttonPanelLayout.createSequentialGroup() + GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup() .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); - buttonPanelLayout.setVerticalGroup( - buttonPanelLayout.createSequentialGroup() - .addComponent(backButton)); - - -// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); -// buttonPanel.setLayout(buttonPanelLayout); -// -// buttonPanelLayout.setHorizontalGroup( -// buttonPanelLayout.createSequentialGroup() -// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) -// .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); -// buttonPanelLayout.setVerticalGroup( -// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) -// .addComponent(saveButton) -// .addComponent(backButton)); + .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + GroupLayout.ParallelGroup buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(backButton); + + if (renderCancelButton) { + //render save button + JButton saveButton = new JButton(); + saveButton.setText(messages.getString(BUTTON_SAVE)); + saveButton.setActionCommand(saveCommand); + saveButton.addActionListener(saveListener); + + buttonHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + buttonVertical + .addComponent(saveButton); + } + + buttonPanelLayout.setHorizontalGroup(buttonHorizontal); + buttonPanelLayout.setVerticalGroup(buttonVertical); contentPanel.validate(); } @@ -1243,36 +1362,36 @@ public class SimpleGUI implements BKUGUIFacade { }); } - private static String getText(HashDataInput hdi) throws IOException { - ByteArrayOutputStream baos = null; - try { - InputStream hashDataIS = hdi.getHashDataInput(); - if (hashDataIS == null) { - log.error("No HashDataInput stream for reference " + hdi.getReferenceId()); - return null; - } else { - baos = new ByteArrayOutputStream(hashDataIS.available()); - int c; - while ((c = hashDataIS.read()) != -1) { - baos.write(c); - } - String encoding = hdi.getEncoding(); - if (encoding == null) { - //default for URL-encoded - encoding = "UTF-8"; - } - return baos.toString(encoding); - } - } catch (IOException ex) { - log.error("Failed to read HashDataInput for reference " + hdi.getReferenceId() + ": " + ex.getMessage()); - throw ex; - } finally { - try { - baos.close(); - } catch (IOException ex) { - } - } - } +// private static String getText(HashDataInput hdi) throws IOException { +// ByteArrayOutputStream baos = null; +// try { +// InputStream hashDataIS = hdi.getHashDataInput(); +// if (hashDataIS == null) { +// log.error("No HashDataInput stream for reference " + hdi.getReferenceId()); +// return null; +// } else { +// baos = new ByteArrayOutputStream(hashDataIS.available()); +// int c; +// while ((c = hashDataIS.read()) != -1) { +// baos.write(c); +// } +// String encoding = hdi.getEncoding(); +// if (encoding == null) { +// //default for URL-encoded +// encoding = "UTF-8"; +// } +// return baos.toString(encoding); +// } +// } catch (IOException ex) { +// log.error("Failed to read HashDataInput for reference " + hdi.getReferenceId() + ": " + ex.getMessage()); +// throw ex; +// } finally { +// try { +// baos.close(); +// } catch (IOException ex) { +// } +// } +// } private void registerHelpListener(ActionListener helpListener) { if (helpListener != null) { diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index 5f62c05a..b5a74ac1 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -14,7 +14,7 @@ # limitations under the License. title.welcome=Willkommen -title.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken +title.insertcard=Keine B\u00FCrgerkarte gefunden title.cardnotsupported=Die Karte wird nicht unterst\u00FCtzt title.cardpin={0} eingeben title.sign=Signatur erstellen diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties index d963fd5f..94464982 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties @@ -14,7 +14,7 @@ # limitations under the License. title.welcome=Welcome -title.insertcard=Please insert your citizen-card into the reader +title.insertcard=No citizen-card found title.cardnotsupported=This card is not supported title.cardpin=Enter {0} title.sign=Create signature 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 c32a237a..b57e1923 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 @@ -32,15 +32,16 @@ import org.junit.Test; * * @author clemens */ +@Ignore public class BKUGUITest { - @Ignore + @Test public void testBKUGUI() { JFrame testFrame = new JFrame("BKUGUITest"); BKUGUI gui = new BKUGUI(); Container contentPane = testFrame.getContentPane(); contentPane.setPreferredSize(new Dimension(380, 150)); - gui.init(contentPane, null, null, null); + gui.init(contentPane, null, BKUGUIFacade.Style.advanced, null, null); BKUGUIWorker worker = new BKUGUIWorker(); worker.init(gui); testFrame.pack(); diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java index af1368e5..e4936067 100644 --- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java +++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java @@ -43,7 +43,7 @@ public class BKUGUIWorker implements Runnable { @Override public void run() { - try { +// try { final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN"); @@ -176,7 +176,7 @@ public class BKUGUIWorker implements Runnable { // signedRefs.add(signedRef4); // signedRefs.add(signedRef4); // signedRefs = Collections.singletonList(signedRef1); - gui.showHashDataInputDialog(signedRefs, true, returnListener, "return"); + gui.showHashDataInputDialog(signedRefs, returnListener, "return"); } }; @@ -184,64 +184,64 @@ public class BKUGUIWorker implements Runnable { gui.showWelcomeDialog(); - Thread.sleep(2000); - - gui.showWaitDialog(null); - - Thread.sleep(1000); - - gui.showWaitDialog("test"); - - Thread.sleep(1000); - - - gui.showInsertCardDialog(cancelListener, "cancel"); - - Thread.sleep(2000); - - gui.showCardNotSupportedDialog(cancelListener, "cancel"); - - Thread.sleep(2000); - - PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN"); - - gui.showCardPINDialog(cardPinSpec, okListener, "ok", cancelListener, "cancel"); - - Thread.sleep(2000); - - gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); - - Thread.sleep(4000); - - gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); - - Thread.sleep(2000); - - gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}, null, null); - - Thread.sleep(2000); - - gui.showErrorDialog("error.test", new Object[] {"Testfehler", "noch ein TestFehler"}); - - Thread.sleep(2000); - - gui.showErrorDialog("error.no.hashdata", null); - - Thread.sleep(2000); - - gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}); - - Thread.sleep(2000); - - gui.showErrorDialog("error.unknown", null); +// Thread.sleep(2000); +// +// gui.showWaitDialog(null); +// +// Thread.sleep(1000); +// +// gui.showWaitDialog("test"); +// +// Thread.sleep(1000); +// +// +// gui.showInsertCardDialog(cancelListener, "cancel"); +// +// Thread.sleep(2000); +// +// gui.showCardNotSupportedDialog(cancelListener, "cancel"); +// +// Thread.sleep(2000); +// +// PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN"); +// +// gui.showCardPINDialog(cardPinSpec, okListener, "ok", cancelListener, "cancel"); +// +// Thread.sleep(2000); +// +// gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); +// +// Thread.sleep(4000); +// +// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}, null, null); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog("error.test", new Object[] {"Testfehler", "noch ein TestFehler"}); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog("error.no.hashdata", null); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog("error.unknown", null); // gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save"); // gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save"); // Thread.sleep(2000); - } catch (InterruptedException ex) { - ex.printStackTrace(); - } +// } catch (InterruptedException ex) { +// ex.printStackTrace(); +// } } } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java index fb8f2432..eaa4d6ad 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java @@ -37,10 +37,10 @@ public class BKUGuiProxy implements BKUGUIFacade { return delegate.getPin(); } - @Override - public void init(Container contentPane, Locale locale, URL bgImage, ActionListener helpListener) { - delegate.init(contentPane, locale, bgImage, helpListener); - } +// @Override +// public void init(Container contentPane, Locale locale, URL bgImage, ActionListener helpListener) { +// delegate.init(contentPane, locale, bgImage, helpListener); +// } @Override public Locale getLocale() { @@ -126,11 +126,9 @@ public class BKUGuiProxy implements BKUGUIFacade { @Override public void showHashDataInputDialog(List signedReferences, - boolean externalDisplay, ActionListener okListener, String okCommand) { showDialog(); - delegate.showHashDataInputDialog(signedReferences, externalDisplay, okListener, - okCommand); + delegate.showHashDataInputDialog(signedReferences, okListener, okCommand); } } diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java index 19e6a657..bfce0f0d 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java @@ -109,7 +109,7 @@ public class LocalSignRequestHandler extends SignRequestHandler { log.error("dsig:SignedInfo does not contain a data reference"); throw new Exception("dsig:SignedInfo does not contain a data reference"); } - gui.showHashDataInputDialog(selectedHashDataInputs, false, this, "ok"); + gui.showHashDataInputDialog(selectedHashDataInputs, this, "ok"); } private ByteArrayHashDataInput getByteArrayHashDataInput(HashDataInput hashDataInput) throws IOException { diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java index cad8cfb6..7012fec0 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java @@ -48,7 +48,6 @@ public class SMCCSTALFactory implements STALFactory { if (locale != null) { dialog.setLocale(locale); } - BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI); DefaultHelpListener helpListener = null; try { if (helpURL != null) { @@ -60,7 +59,11 @@ public class SMCCSTALFactory implements STALFactory { } catch (MalformedURLException ex) { log.error("failed to configure help listener: " + ex.getMessage(), ex); } - gui.init(dialog.getContentPane(), dialog.getLocale(), null, helpListener); + BKUGUIFacade gui = BKUGUIFactory.createGUI(dialog.getContentPane(), + dialog.getLocale(), + BKUGUIFactory.ADVANCED_GUI, + null, + helpListener); stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog); dialog.setPreferredSize(new Dimension(400, 200)); dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); diff --git a/BKUOnline/src/main/webapp/HTTP-ohne.html b/BKUOnline/src/main/webapp/HTTP-ohne.html index 112a1d92..607fa5d4 100644 --- a/BKUOnline/src/main/webapp/HTTP-ohne.html +++ b/BKUOnline/src/main/webapp/HTTP-ohne.html @@ -101,7 +101,7 @@ legend { Frame Browser - Applet +

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 9d23315c..38247174 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 @@ -38,6 +38,8 @@ import java.util.Collections; import java.util.List; import java.util.Locale; import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.swing.CellRendererPane; import javax.swing.GroupLayout; import javax.swing.ImageIcon; @@ -50,8 +52,12 @@ import javax.swing.JPasswordField; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.LayoutStyle; +import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumn; import javax.swing.table.TableModel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -1013,80 +1019,75 @@ public class BKUGUIImpl implements BKUGUIFacade { } if (signedReferences.size() == 1) { - ActionListener saveHashDataListener = new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - HashDataInput hdi = signedReferences.get(0); - showSaveHashDataInputDialog(Collections.singletonList(hdi), okListener, okCommand); - } - }; - showHashDataViewer(signedReferences.get(0), saveHashDataListener, "save"); + try { + log.debug("scheduling hashdata viewer"); + + SwingUtilities.invokeAndWait(new Runnable() { + + @Override + public void run() { + ActionListener saveHashDataListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + HashDataInput hdi = signedReferences.get(0); + showSaveHashDataInputDialog(Collections.singletonList(hdi), okListener, okCommand); + } + }; + showHashDataViewer(signedReferences.get(0), saveHashDataListener, "save"); + } + }); + + } catch (InterruptedException ex) { + log.error("Failed to display HashDataViewer: " + ex.getMessage()); + } catch (InvocationTargetException ex) { + log.error("Failed to display HashDataViewer: " + ex.getMessage()); + } } else { - HashDataTableModel tableModel = new HashDataTableModel(signedReferences); - showSignedReferencesListDialog(tableModel, okListener, okCommand); + showSignedReferencesListDialog(signedReferences, okListener, okCommand); } } /** * Opens HashDataViewer on mouse clicked event */ - public class HashDataMouseListener extends MouseAdapter { - - private HashDataInput hashData; - - public void setHashData(HashDataInput hashData) { - this.hashData = hashData; - } - - @Override - public void mouseClicked(MouseEvent e) { - ActionListener saveListener = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - showSaveHashDataInputDialog(Collections.singletonList(hashData), null, null); - } - }; - showHashDataViewer(hashData, saveListener, "save"); - super.mouseClicked(e); - } - - - - } +// public class HashDataMouseListener extends MouseAdapter { +// +// private HashDataInput hashData; +// +// public void setHashData(HashDataInput hashData) { +// this.hashData = hashData; +// } +// +// @Override +// public void mouseClicked(MouseEvent e) { +// ActionListener saveListener = new ActionListener() { +// +// @Override +// public void actionPerformed(ActionEvent e) { +// showSaveHashDataInputDialog(Collections.singletonList(hashData), null, null); +// } +// }; +// showHashDataViewer(hashData, saveListener, "save"); +// super.mouseClicked(e); +// } +// } /** - * blocks until dialog returns (is closed) + * has to be called from event dispatcher thread * @param hashDataText * @param saveListener * @param saveCommand */ private void showHashDataViewer(final HashDataInput hashDataInput, final ActionListener saveListener, final String saveCommand) { - try { - log.debug("scheduling plaintext hashdatainput dialog"); - - // avoid double-clicks on hashdata link - SwingUtilities.invokeAndWait(new Runnable() { - - @Override - public void run() { - - log.debug("show plaintext hashdatainput dialog"); + log.debug("show hashdata viewer"); - ActionListener l = helpListener.getActionListener(); - HashDataViewer.showHashDataInput(contentPane, hashDataInput, messages, saveListener, saveCommand, l); - } - }); - - } catch (InterruptedException ex) { - log.error("Failed to display HashDataViewer: " + ex.getMessage()); - } catch (InvocationTargetException ex) { - log.error("Failed to display HashDataViewer: " + ex.getMessage()); - } + ActionListener l = helpListener.getActionListener(); + HashDataViewer.showHashDataInput(contentPane, hashDataInput, messages, saveListener, saveCommand, l); } - private void showSignedReferencesListDialog(final HashDataTableModel signedReferences, final ActionListener backListener, final String backCommand) { + private void showSignedReferencesListDialog(final List signedReferences, final ActionListener backListener, final String backCommand) { log.debug("scheduling signed references list dialog"); @@ -1109,21 +1110,40 @@ public class BKUGUIImpl implements BKUGUIFacade { JLabel refIdLabel = new JLabel(); refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); String refIdLabelPattern = messages.getString(MESSAGE_HASHDATALIST); - refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.getRowCount()})); + refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.size()})); - JTable hashDataTable = new JTable(signedReferences); - hashDataTable.setDefaultRenderer(HashDataInput.class, signedReferences.getRenderer()); - + HashDataTableModel tableModel = new HashDataTableModel(signedReferences); + JTable hashDataTable = new JTable(tableModel); +// hashDataTable.setDefaultRenderer(HashDataInput.class, signedReferences.getRenderer()); hashDataTable.setTableHeader(null); - // hashDataTable.setShowVerticalLines(false); - hashDataTable.setRowSelectionAllowed(true); -// TableColumn selectCol = hashDataTable.getColumnModel().getColumn(1); -// selectCol.setMinWidth(CHECKBOX_WIDTH); -// selectCol.setMaxWidth(CHECKBOX_WIDTH); + + hashDataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + hashDataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + @Override + public void valueChanged(final ListSelectionEvent e) { + //invoke later to allow thread to paint selection background + SwingUtilities.invokeLater(new Runnable() { -// hashDataTable.setPreferredScrollableViewportSize(mainPanel.getPreferredSize()); + @Override + public void run() { + ListSelectionModel lsm = (ListSelectionModel) e.getSource(); + int selectionIdx = lsm.getMinSelectionIndex(); + if (selectionIdx >= 0) { + final HashDataInput selection = signedReferences.get(selectionIdx); + showHashDataViewer(selection, new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + showSaveHashDataInputDialog(Collections.singletonList(selection), null, null); + } + }, "save"); + } + } + }); + } + }); + JScrollPane hashDataScrollPane = new JScrollPane(hashDataTable); GroupLayout mainPanelLayout = new GroupLayout(mainPanel); @@ -1174,6 +1194,12 @@ public class BKUGUIImpl implements BKUGUIFacade { }); } + /** + * + * @param signedRefs + * @param okListener may be null + * @param okCommand + */ private void showSaveHashDataInputDialog(final List signedRefs, final ActionListener okListener, final String okCommand) { log.debug("scheduling save hashdatainput dialog"); diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java index a6709860..9a43e99d 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java @@ -17,21 +17,8 @@ package at.gv.egiz.bku.gui; import at.gv.egiz.stal.HashDataInput; -import java.awt.Color; -import java.awt.Component; -import java.awt.Cursor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; import java.util.List; -import javax.swing.JDialog; -import javax.swing.JLabel; -import javax.swing.JOptionPane; -import javax.swing.JTable; import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableCellRenderer; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -43,17 +30,15 @@ class HashDataTableModel extends DefaultTableModel { protected static final Log log = LogFactory.getLog(HashDataTableModel.class); - protected Class[] types = new Class[]{HashDataInput.class}; + protected Class[] types = new Class[]{ String.class, String.class }; protected List hashDataInputs; - private HashDataLinkRenderer renderer; public HashDataTableModel(List hashDataInputs) { - super(0, 1); + super(0, 2); this.hashDataInputs = hashDataInputs; for (HashDataInput hdi : hashDataInputs) { - addRow(new Object[]{hdi}); + addRow(new Object[]{hdi.getReferenceId(), hdi.getMimeType()}); } - this.renderer = new HashDataLinkRenderer(); } @Override @@ -66,46 +51,45 @@ class HashDataTableModel extends DefaultTableModel { return false; } - - - public HashDataLinkRenderer getRenderer() { - return renderer; - } +// public HashDataInput getValue(int rowIndex) { +// return hashDataInputs.get(rowIndex); +// } +// - public class HashDataLinkRenderer extends JLabel - implements TableCellRenderer { -// extends DefaultTableCellRenderer { - -// protected ActionListener saveHashDataListener; +// public class HashDataLinkRenderer extends JLabel +// implements TableCellRenderer { +//// extends DefaultTableCellRenderer { +// +//// protected ActionListener saveHashDataListener; +//// +//// public HashDataLinkRenderer(ActionListener saveHashDataListener) { +//// this.saveHashDataListener = saveHashDataListener; +//// } +// +// @Override +// public Component getTableCellRendererComponent(JTable table, +// Object value, +// boolean isSelected, +// boolean hasFocus, +// final int row, +// int column) { +// final HashDataInput hdi = (HashDataInput) value; +// log.debug("render hashdatainput " + hdi.getReferenceId() + " - (" + row + "," + column + ") " + isSelected + hasFocus); +// setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); +// setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD)); +// setText(hdi.getReferenceId() + " (" + hdi.getMimeType() + ")"); +// addMouseListener(new MouseAdapter() { +// +// @Override +// public void mouseClicked(MouseEvent e) { +// log.debug("received mouseclick on " + hdi.getReferenceId()); +//// saveHashDataListener.actionPerformed(); +// JOptionPane.showInputDialog(hashDataInputs.get(row).getReferenceId()); +// } +// +// }); // -// public HashDataLinkRenderer(ActionListener saveHashDataListener) { -// this.saveHashDataListener = saveHashDataListener; +// return this; // } - - @Override - public Component getTableCellRendererComponent(JTable table, - Object value, - boolean isSelected, - boolean hasFocus, - final int row, - int column) { - final HashDataInput hdi = (HashDataInput) value; - log.debug("render hashdatainput " + hdi.getReferenceId() + " - (" + row + "," + column + ") " + isSelected + hasFocus); - setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD)); - setText(hdi.getReferenceId() + " (" + hdi.getMimeType() + ")"); - addMouseListener(new MouseAdapter() { - - @Override - public void mouseClicked(MouseEvent e) { - log.debug("received mouseclick on " + hdi.getReferenceId()); -// saveHashDataListener.actionPerformed(); - JOptionPane.showInputDialog(hashDataInputs.get(row).getReferenceId()); - } - - }); - - return this; - } - } +// } } \ No newline at end of file diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java index db66bd52..263c3c04 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java @@ -16,6 +16,7 @@ */ package at.gv.egiz.bku.gui; +import at.gv.egiz.bku.gui.html.RestrictedHTMLEditorKit; import at.gv.egiz.stal.HashDataInput; import java.awt.Component; import java.awt.Container; @@ -45,6 +46,7 @@ import javax.swing.JScrollPane; import javax.swing.LayoutStyle; import javax.swing.text.Document; import javax.swing.text.EditorKit; +import javax.swing.text.StyledEditorKit; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -182,9 +184,11 @@ public class HashDataViewer extends JDialog JEditorPane viewer = new JEditorPane(); if ("text/plain".equals(mimeType)) { + //line wrapping, etc. + viewer.setEditorKit(new StyledEditorKit()); viewer.setFont(new Font(PLAINTEXT_FONT, viewer.getFont().getStyle(), viewer.getFont().getSize())); // } else if ("text/html".equals(mimeType)) { -// viewer.setEditorKitForContentType("text/html", new RestrictedHTMLEditorKit()); +// viewer.setEditorKit(new RestrictedHTMLEditorKit()); } viewer.setEditable(false); viewer.setContentType(mimeType); diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java index 82b42d0f..fec097f5 100644 --- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java +++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java @@ -81,7 +81,7 @@ public class BKUGUIWorker implements Runnable { }; HashDataInput signedRef1 = new ByteArrayHashDataInput( "Ich bin ein einfacher Text mit Umlauten: öäüßéç@€\n123\n456\n\tHello, world!\n\nlkjsd\nnksdjf".getBytes(), - "ref-id-000000001", + "ref-id-0000000000000000000000001", "text/plain", "UTF-8"); diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java index 26905f50..d041a8cb 100644 --- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java +++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java @@ -48,7 +48,6 @@ import at.gv.egiz.stal.SignResponse; import at.gv.egiz.stal.signedinfo.ObjectFactory; import at.gv.egiz.stal.signedinfo.SignedInfoType; import at.gv.egiz.stal.util.JCEAlgorithmNames; -import java.awt.event.ActionListener; import java.security.DigestException; import java.util.List; @@ -128,9 +127,6 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen return true; } -// @Override -// public String providePIN(PINSpec spec, int retries) { - class STALPinProvider implements PINProvider { protected SignedInfoType signedInfo; @@ -178,7 +174,7 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen } else if (actionCommand.equals("sign")) { retryCounter++; return new String(gui.getPin()); - } else if (actionCommand.equals("ok")) { + } else if (actionCommand.equals("hashDataDone")) { showSignaturePINDialog(spec, retries); } else if (actionCommand.equals("error")) { return null; -- cgit v1.2.3 From d8901c075f9deb663e0edd640672ed620ffb4610 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 19 Nov 2008 16:14:57 +0000 Subject: GUI bugfixes and cleanup git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@181 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/src/test/resources/appletTest.html | 3 +- .../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 26 +----- .../main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 103 +++++++++------------ .../at/gv/egiz/bku/gui/DefaultHelpListener.java | 4 + .../at/gv/egiz/bku/gui/HashDataTableModel.java | 47 +--------- .../java/at/gv/egiz/bku/gui/HashDataViewer.java | 1 - .../java/at/gv/egiz/bku/gui/HyperlinkRenderer.java | 38 ++++++++ .../at/gv/egiz/bku/gui/Messages.properties | 3 +- .../at/gv/egiz/bku/gui/Messages_en.properties | 15 +-- 9 files changed, 101 insertions(+), 139 deletions(-) create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java (limited to 'BKUApplet') diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html index 2570e021..cc7c2bd7 100644 --- a/BKUApplet/src/test/resources/appletTest.html +++ b/BKUApplet/src/test/resources/appletTest.html @@ -20,7 +20,8 @@ - + + diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index 2dbba730..7d912f11 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -19,9 +19,7 @@ package at.gv.egiz.bku.gui; import at.gv.egiz.stal.HashDataInput; import at.gv.egiz.smcc.PINSpec; import java.awt.Color; -import java.awt.Container; import java.awt.event.ActionListener; -import java.net.URL; import java.util.List; import java.util.Locale; @@ -71,7 +69,6 @@ public interface BKUGUIFacade { public static final String MESSAGE_HELP = "message.help"; public static final String LABEL_PIN = "label.pin"; public static final String LABEL_PINSIZE = "label.pinsize"; -// public static final String ERROR_NO_HASHDATA = "error.no.hashdata"; public static final String HELP_WELCOME = "help.welcome"; public static final String HELP_WAIT = "help.wait"; public static final String HELP_CARDNOTSUPPORTED = "help.cardnotsupported"; @@ -95,17 +92,13 @@ public interface BKUGUIFacade { // public void init(Container contentPane, Locale locale, Style guiStyle, URL background, ActionListener helpListener); - /** - * - * @return the locale of the message bundle (what if no message bundle could be loaded for the requested locale?) - */ public Locale getLocale(); public void showWelcomeDialog(); /** * - * @param waitMessage if null, a simple 'wait' text is displayed + * @param waitMessage if null, a simple 'please wait' text is displayed */ public void showWaitDialog(String waitMessage); @@ -123,25 +116,8 @@ public interface BKUGUIFacade { public char[] getPin(); - /** - * TODO move to HashDataDisplay implementations - * @param signedReferences - * @param externalDisplay - * @param okListener - * @param okCommand - */ public void showHashDataInputDialog(List signedReferences, ActionListener okListener, String okCommand); - /** - * TODO pull out from BKUGUIFacade. (or make this strictly an applet internal version) - * Problem: if standalone flag is provided, we also need the actionlistener.. - * @param helpDocument - * @param mimeType - * @param encoding - */ -// public void showHelpDialog(InputStream helpDocument, String mimeType, String encoding); //, boolean standalone); //, ActionListener okListener, String okCommand); - -// public void showPlainTextHashDataInputDialog(String text, ActionListener saveListener, String saveCommand, ActionListener cancelListener, String cancelCommand); public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams, ActionListener okListener, String actionCommand); public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams); 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 38247174..a190b9c0 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 @@ -26,6 +26,8 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionAdapter; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; @@ -554,44 +556,37 @@ public class BKUGUIImpl implements BKUGUIFacade { GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); - GroupLayout.ParallelGroup mainHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); - GroupLayout.SequentialGroup pinHorizontal = mainPanelLayout.createSequentialGroup() - .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //)) - .addComponent(pinsizeLabel)); - - GroupLayout.SequentialGroup mainVertical = mainPanelLayout.createSequentialGroup(); + GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup() + .addComponent(infoLabel); + GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(infoLabel); if (!renderHeaderPanel) { - GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup() - .addComponent(infoLabel) //, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); + infoHorizontal .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel); //, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - mainHorizontal - .addGroup(infoHorizontal) - .addGroup(pinHorizontal); - GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(infoLabel) .addComponent(helpLabel); - mainVertical - .addGroup(infoVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); - } else { - mainHorizontal - .addGroup(pinHorizontal); - } - - mainVertical - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(cardPinLabel) - .addComponent(pinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinsizeLabel); + infoVertical + .addComponent(helpLabel); + } - mainPanelLayout.setHorizontalGroup(mainHorizontal); - mainPanelLayout.setVerticalGroup(mainVertical); + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(infoHorizontal) + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //)) + .addComponent(pinsizeLabel)))); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addGroup(infoVertical) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(cardPinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel)); GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); @@ -1048,31 +1043,6 @@ public class BKUGUIImpl implements BKUGUIFacade { } } - /** - * Opens HashDataViewer on mouse clicked event - */ -// public class HashDataMouseListener extends MouseAdapter { -// -// private HashDataInput hashData; -// -// public void setHashData(HashDataInput hashData) { -// this.hashData = hashData; -// } -// -// @Override -// public void mouseClicked(MouseEvent e) { -// ActionListener saveListener = new ActionListener() { -// -// @Override -// public void actionPerformed(ActionEvent e) { -// showSaveHashDataInputDialog(Collections.singletonList(hashData), null, null); -// } -// }; -// showHashDataViewer(hashData, saveListener, "save"); -// super.mouseClicked(e); -// } -// } - /** * has to be called from event dispatcher thread * @param hashDataText @@ -1113,10 +1083,23 @@ public class BKUGUIImpl implements BKUGUIFacade { refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.size()})); HashDataTableModel tableModel = new HashDataTableModel(signedReferences); - JTable hashDataTable = new JTable(tableModel); -// hashDataTable.setDefaultRenderer(HashDataInput.class, signedReferences.getRenderer()); + final JTable hashDataTable = new JTable(tableModel); + hashDataTable.setDefaultRenderer(HashDataInput.class, new HyperlinkRenderer()); hashDataTable.setTableHeader(null); + // not possible to add mouse listener to TableCellRenderer + hashDataTable.addMouseMotionListener(new MouseMotionAdapter() { + + @Override + public void mouseMoved(MouseEvent e) { + if (hashDataTable.columnAtPoint(e.getPoint()) == 0) { + hashDataTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } else { + hashDataTable.setCursor(Cursor.getDefaultCursor()); + } + } + }); + hashDataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); hashDataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java index 502f93ec..3c8c7d6c 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java @@ -27,6 +27,10 @@ import javax.swing.SwingUtilities; */ public class DefaultHelpListener extends AbstractHelpListener { + /** + * applet context to open external links in help pages, + * if null, no external links will be opened + */ protected AppletContext ctx; /** diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java index 9a43e99d..b0f51a78 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java @@ -30,14 +30,15 @@ class HashDataTableModel extends DefaultTableModel { protected static final Log log = LogFactory.getLog(HashDataTableModel.class); - protected Class[] types = new Class[]{ String.class, String.class }; + /** HashDataInput in first column, register hyperlinkrenderer only here */ + protected Class[] types = new Class[]{ HashDataInput.class, String.class }; protected List hashDataInputs; public HashDataTableModel(List hashDataInputs) { super(0, 2); this.hashDataInputs = hashDataInputs; for (HashDataInput hdi : hashDataInputs) { - addRow(new Object[]{hdi.getReferenceId(), hdi.getMimeType()}); + addRow(new Object[]{ hdi, hdi.getMimeType()}); } } @@ -50,46 +51,4 @@ class HashDataTableModel extends DefaultTableModel { public boolean isCellEditable(int rowIndex, int columnIndex) { return false; } - -// public HashDataInput getValue(int rowIndex) { -// return hashDataInputs.get(rowIndex); -// } -// - -// public class HashDataLinkRenderer extends JLabel -// implements TableCellRenderer { -//// extends DefaultTableCellRenderer { -// -//// protected ActionListener saveHashDataListener; -//// -//// public HashDataLinkRenderer(ActionListener saveHashDataListener) { -//// this.saveHashDataListener = saveHashDataListener; -//// } -// -// @Override -// public Component getTableCellRendererComponent(JTable table, -// Object value, -// boolean isSelected, -// boolean hasFocus, -// final int row, -// int column) { -// final HashDataInput hdi = (HashDataInput) value; -// log.debug("render hashdatainput " + hdi.getReferenceId() + " - (" + row + "," + column + ") " + isSelected + hasFocus); -// setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); -// setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD)); -// setText(hdi.getReferenceId() + " (" + hdi.getMimeType() + ")"); -// addMouseListener(new MouseAdapter() { -// -// @Override -// public void mouseClicked(MouseEvent e) { -// log.debug("received mouseclick on " + hdi.getReferenceId()); -//// saveHashDataListener.actionPerformed(); -// JOptionPane.showInputDialog(hashDataInputs.get(row).getReferenceId()); -// } -// -// }); -// -// return this; -// } -// } } \ No newline at end of file diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java index 263c3c04..777e8960 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java @@ -184,7 +184,6 @@ public class HashDataViewer extends JDialog JEditorPane viewer = new JEditorPane(); if ("text/plain".equals(mimeType)) { - //line wrapping, etc. viewer.setEditorKit(new StyledEditorKit()); viewer.setFont(new Font(PLAINTEXT_FONT, viewer.getFont().getStyle(), viewer.getFont().getSize())); // } else if ("text/html".equals(mimeType)) { diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java new file mode 100644 index 00000000..f983706e --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java @@ -0,0 +1,38 @@ +/* + * Copyright 2008 Federal Chancellery Austria and + * Graz University of Technology + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package at.gv.egiz.bku.gui; + +import at.gv.egiz.stal.HashDataInput; +import javax.swing.table.DefaultTableCellRenderer; + +/** + * + * @author Clemens Orthacker + */ +public class HyperlinkRenderer extends DefaultTableCellRenderer { + + /** + * cannot change mouse cursor here, do in jTable + * @param value + */ + @Override + protected void setValue(Object value) { + super.setText("" + ((HashDataInput) value).getReferenceId() + ""); + setForeground(BKUGUIFacade.HYPERLINK_COLOR); + } +} diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index b5a74ac1..88119fe2 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -16,7 +16,8 @@ title.welcome=Willkommen title.insertcard=Keine B\u00FCrgerkarte gefunden title.cardnotsupported=Die Karte wird nicht unterst\u00FCtzt -title.cardpin={0} eingeben +#title.cardpin={0} eingeben +title.cardpin=Karte wird gelesen title.sign=Signatur erstellen title.error=Fehler title.retry=Falscher PIN diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties index 94464982..63c8bf77 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties @@ -14,9 +14,10 @@ # limitations under the License. title.welcome=Welcome -title.insertcard=No citizen-card found +title.insertcard=No citizencard found title.cardnotsupported=This card is not supported -title.cardpin=Enter {0} +#title.cardpin=Enter {0} +title.cardpin=Reading card title.sign=Create signature title.error=Error title.retry=Wrong PIN @@ -28,7 +29,7 @@ windowtitle.overwrite=Overwrite file? windowtitle.viewer=Signature data windowtitle.help=Help message.wait=Please wait... -message.insertcard=Please insert your citizen-card into the reader +message.insertcard=Please insert your citizencard into the reader message.enterpin=Enter {0} message.hashdatalink=Display signature data message.hashdata=Remark: This is a preview of the data to-be signed. For standards compliant display see help. @@ -63,16 +64,16 @@ error.pcsc=No PC/SC interface for smartcard access provided error.cardterminal=Could not find smartcard reader error.unknown=An error occured: {0} error.test=Error1 {0} - Error2 {1} -error.card.locked=Citizen-card is locked -error.card.notactivated=Citizen-card not activated +error.card.locked=Citizencard is locked +error.card.notactivated=Citizencard not activated error.viewer=Failed to display contents: {0} error.external.link=Externer Link {0} wird nicht ge\u00F6ffnet # Help Topics help.welcome=Welcome page help.wait=Wait screen -help.cardnotsupported=Unsupported citizen card -help.insertcard=No citizen card found +help.cardnotsupported=Unsupported citizencard +help.insertcard=No citizencard found help.cardpin=Pin entry help.signpin=Signature pin entry help.retry=Wrong Pin -- cgit v1.2.3 From 11c83e13e032738ee927f22196dc9ca43589a8a4 Mon Sep 17 00:00:00 2001 From: mcentner Date: Mon, 24 Nov 2008 14:11:39 +0000 Subject: Version set to 1.0.0 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@193 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/pom.xml | 14 +++++++------- BKUCommonGUI/pom.xml | 8 ++++---- BKULocal/pom.xml | 14 +++++++------- BKULocalApp/pom.xml | 8 ++++---- BKUOnline/pom.xml | 10 +++++----- BKUOnline/src/main/webapp/appletPage.jsp | 2 +- BKUViewer/pom.xml | 6 +++--- STAL/pom.xml | 4 ++-- STALService/pom.xml | 8 ++++---- bkucommon/pom.xml | 8 ++++---- pom.xml | 6 +++--- smcc/pom.xml | 4 ++-- smccSTAL/pom.xml | 10 +++++----- utils/pom.xml | 8 ++++---- 14 files changed, 55 insertions(+), 55 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml index eaaa5820..10cfa53a 100644 --- a/BKUApplet/pom.xml +++ b/BKUApplet/pom.xml @@ -3,13 +3,13 @@ bku at.gv.egiz - 1.0 + 1.0.0-SNAPSHOT 4.0.0 at.gv.egiz BKUApplet BKU Applet - 1.0 + 1.0.0-SNAPSHOT @@ -116,27 +116,27 @@ at.gv.egiz smcc - 1.0 + 1.0.0-SNAPSHOT at.gv.egiz STAL - 1.0 + 1.0.0-SNAPSHOT at.gv.egiz STALService - 1.0 + 1.0.0-SNAPSHOT at.gv.egiz smccSTAL - 1.0 + 1.0.0-SNAPSHOT at.gv.egiz BKUCommonGUI - 1.0 + 1.0.0-SNAPSHOT commons-logging diff --git a/BKUCommonGUI/pom.xml b/BKUCommonGUI/pom.xml index c620746f..1cedb84d 100644 --- a/BKUCommonGUI/pom.xml +++ b/BKUCommonGUI/pom.xml @@ -3,23 +3,23 @@ bku at.gv.egiz - 1.0 + 1.0.0-SNAPSHOT 4.0.0 at.gv.egiz BKUCommonGUI BKU Common GUI - 1.0 + 1.0.0-SNAPSHOT at.gv.egiz smcc - 1.0 + 1.0.0-SNAPSHOT at.gv.egiz STAL - 1.0 + 1.0.0-SNAPSHOT compile diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index 36503ca0..48b6d590 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -3,14 +3,14 @@ bku at.gv.egiz - 1.0 + 1.0.0-SNAPSHOT 4.0.0 at.gv.egiz BKULocal war BKU Local - 1.0-SNAPSHOT + 1.0.0-SNAPSHOT scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal @@ -57,22 +57,22 @@ at.gv.egiz STAL - 1.0 + 1.0.0-SNAPSHOT at.gv.egiz bkucommon - 1.0 + 1.0.0-SNAPSHOT at.gv.egiz smcc - 1.0 + 1.0.0-SNAPSHOT at.gv.egiz smccSTAL - 1.0 + 1.0.0-SNAPSHOT org.springframework @@ -102,7 +102,7 @@ at.gv.egiz BKUViewer - 1.0 + 1.0.0-SNAPSHOT diff --git a/BKULocalApp/pom.xml b/BKULocalApp/pom.xml index f05aeba0..4476f3b5 100644 --- a/BKULocalApp/pom.xml +++ b/BKULocalApp/pom.xml @@ -3,13 +3,13 @@ bku at.gv.egiz - 1.0-SNAPSHOT + 1.0.0-SNAPSHOT 4.0.0 at.gv.egiz.bku BKULocalApp BKU Local App - 1.0-SNAPSHOT + 1.0.0-SNAPSHOT @@ -77,13 +77,13 @@ at.gv.egiz BKULocal - 1.0-SNAPSHOT + 1.0.0-SNAPSHOT war utils at.gv.egiz - 1.0-SNAPSHOT + 1.0.0-SNAPSHOT compile diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index a1d92390..cee17e20 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -4,14 +4,14 @@ bku at.gv.egiz - 1.0 + 1.0.0-SNAPSHOT 4.0.0 at.gv.egiz BKUOnline war BKU Online - 1.0 + 1.0.0-SNAPSHOT @@ -25,12 +25,12 @@ at.gv.egiz bkucommon - 1.0 + 1.0.0-SNAPSHOT at.gv.egiz BKUViewer - 1.0 + 1.0.0-SNAPSHOT commons-logging @@ -62,7 +62,7 @@ at.gv.egiz BKUApplet - 1.0 + 1.0.0-SNAPSHOT provided \ No newline at end of file diff --git a/bkucommon/pom.xml b/bkucommon/pom.xml index 60c31a02..076f516c 100644 --- a/bkucommon/pom.xml +++ b/bkucommon/pom.xml @@ -4,24 +4,24 @@ bku at.gv.egiz - 1.0 + 1.0.0-SNAPSHOT 4.0.0 at.gv.egiz bkucommon BKU Common - 1.0 + 1.0.0-SNAPSHOT http://maven.apache.org at.gv.egiz utils - 1.0 + 1.0.0-SNAPSHOT at.gv.egiz STAL - 1.0 + 1.0.0-SNAPSHOT commons-logging diff --git a/pom.xml b/pom.xml index 54413a62..fa86e771 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ at.gv.egiz bku pom - 1.0 + 1.0.0-SNAPSHOT BKU http://bku.egiz.gv.at @@ -97,7 +97,7 @@ org.apache.maven.plugins maven-release-plugin - 2.0-beta-7 + 2.0-beta-8 @@ -211,7 +211,7 @@ iaik iaik_pki - 1.0-SNAPSHOT + 1.0-MOCCA compile diff --git a/smcc/pom.xml b/smcc/pom.xml index 39af114f..ba1ffcce 100644 --- a/smcc/pom.xml +++ b/smcc/pom.xml @@ -3,14 +3,14 @@ bku at.gv.egiz - 1.0 + 1.0.0-SNAPSHOT 4.0.0 at.gv.egiz smcc smcc jar - 1.0 + 1.0.0-SNAPSHOT http://bku.egiz.gv.at diff --git a/smccSTAL/pom.xml b/smccSTAL/pom.xml index 5c03cffd..78ba1aea 100644 --- a/smccSTAL/pom.xml +++ b/smccSTAL/pom.xml @@ -4,13 +4,13 @@ bku at.gv.egiz - 1.0 + 1.0.0-SNAPSHOT 4.0.0 at.gv.egiz smccSTAL smcc STAL - 1.0 + 1.0.0-SNAPSHOT @@ -26,17 +26,17 @@ at.gv.egiz STAL - 1.0 + 1.0.0-SNAPSHOT at.gv.egiz smcc - 1.0 + 1.0.0-SNAPSHOT at.gv.egiz BKUCommonGUI - 1.0 + 1.0.0-SNAPSHOT iaik diff --git a/utils/pom.xml b/utils/pom.xml index b980470d..871dbb0a 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -4,14 +4,14 @@ bku at.gv.egiz - 1.0 + 1.0.0-SNAPSHOT 4.0.0 at.gv.egiz utils BKU Utils jar - 1.0 + 1.0.0-SNAPSHOT http://bku.egiz.gv.at @@ -53,10 +53,10 @@ add dependencies to determine build order of BKU modules | (scope provided -> don't include dependencies in assembly) at.gv.egiz - slbinding 1.0-SNAPSHOT + slbinding 1.0.0-SNAPSHOTOT provided at.gv.egiz idlink - 1.0-SNAPSHOT provided + provided diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index 48b6d590..54de31b2 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -97,7 +97,7 @@ at.gv.egiz BKUApplet - 1.0 + 1.0.0-SNAPSHOT at.gv.egiz diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index cee17e20..1afb9632 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -65,6 +65,13 @@ 1.0.0-SNAPSHOT provided + + at.gv.egiz + STALService + 1.0.0-SNAPSHOT + provided + + @@ -98,10 +105,11 @@ copyapplet - copy + copy-dependencies - + ${project.build.directory}/${project.build.finalName}/applet + + at.gv.egiz + BKUApplet + true -- cgit v1.2.3 From 0177d75af235f00063e8b0866106002237a41d05 Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 24 Nov 2008 17:33:08 +0000 Subject: cleanup git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@199 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java | 5 ----- 1 file changed, 5 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java index b2f9f89c..03e4b7c9 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java @@ -192,11 +192,6 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { private void registerSignRequestHandler() throws MalformedURLException { String hashDataDisplayStyle = params.getAppletParameter(BKUApplet.HASHDATA_DISPLAY); -// if (BKUApplet.HASHDATA_DISPLAY_INTERNAL.equals(hashDataDisplayStyle)) { -// log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL); -// AppletHashDataDisplay handler = new AppletHashDataDisplay(stalPort, sessionId, AppletHashDataDisplay.DISPLAY.applet); -// addRequestHandler(SignRequest.class, handler); -// } else if (BKUApplet.HASHDATA_DISPLAY_BROWSER.equals(hashDataDisplayStyle)) { URL hashDataURL = params.getURLParameter(BKUApplet.HASHDATA_URL, sessionId); log.debug("register SignRequestHandler for HashDataURL " + hashDataURL); -- cgit v1.2.3 From b1209c3cf4a3447b8dd1320a5b068bf205797980 Mon Sep 17 00:00:00 2001 From: mcentner Date: Tue, 25 Nov 2008 07:47:42 +0000 Subject: [maven-release-plugin] prepare release mocca-1.0.1 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@201 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/pom.xml | 295 +++++++++++++++++---------------- BKUCommonGUI/pom.xml | 75 +++++---- BKULocal/pom.xml | 223 +++++++++++++------------ BKULocalApp/pom.xml | 199 +++++++++++----------- BKUOnline/pom.xml | 441 +++++++++++++++++++++++++------------------------ BKUViewer/pom.xml | 9 +- STAL/pom.xml | 6 +- STALService/pom.xml | 9 +- bkucommon/pom.xml | 17 +- pom.xml | 453 +++++++++++++++++++++++++-------------------------- smcc/pom.xml | 85 +++++----- smccSTAL/pom.xml | 96 ++++++----- utils/pom.xml | 149 ++++++++--------- 13 files changed, 1015 insertions(+), 1042 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml index d7d74b5e..6f900ad3 100644 --- a/BKUApplet/pom.xml +++ b/BKUApplet/pom.xml @@ -1,148 +1,147 @@ - - - - bku - at.gv.egiz - 1.0.0-SNAPSHOT - - 4.0.0 - at.gv.egiz - BKUApplet - BKU Applet - 1.0.0-SNAPSHOT - - - - maven-dependency-plugin - - - unpack - - unpack-dependencies - - - at.gv.egiz - true - ${project.build.outputDirectory} - META-INF\/ - - - - - maven-jar-plugin - - - - sign - - - - - - false - false - - false - true - - - test-applet signer - ./keystore.ks - storepass - keypass - true - - - - maven-dependency-plugin - - - copytestlibs - - copy - - - - - commons-logging - commons-logging - - - iaik - iaik_jce_me4se - - - ${project.build.directory}/test-libs - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - true - - - - - - - at.gv.egiz - smcc - 1.0.0-SNAPSHOT - - - at.gv.egiz - STAL - 1.0.0-SNAPSHOT - - - at.gv.egiz - STALService - 1.0.0-SNAPSHOT - - - at.gv.egiz - smccSTAL - 1.0.0-SNAPSHOT - - - at.gv.egiz - BKUCommonGUI - 1.0.0-SNAPSHOT - - - commons-logging - commons-logging - - - + + + bku + at.gv.egiz + 1.0.1 + + 4.0.0 + at.gv.egiz + BKUApplet + BKU Applet + 1.0.1 + + + + maven-dependency-plugin + + + unpack + + unpack-dependencies + + + at.gv.egiz + true + ${project.build.outputDirectory} + META-INF\/ + + + + + maven-jar-plugin + + + + sign + + + + + + false + false + + false + true + + + test-applet signer + ./keystore.ks + storepass + keypass + true + + + + maven-dependency-plugin + + + copytestlibs + + copy + + + + + commons-logging + commons-logging + + + iaik + iaik_jce_me4se + + + ${project.build.directory}/test-libs + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + true + + + + + + + at.gv.egiz + smcc + 1.0.1 + + + at.gv.egiz + STAL + 1.0.1 + + + at.gv.egiz + STALService + 1.0.1 + + + at.gv.egiz + smccSTAL + 1.0.1 + + + at.gv.egiz + BKUCommonGUI + 1.0.1 + + + commons-logging + commons-logging + + + \ No newline at end of file diff --git a/BKUCommonGUI/pom.xml b/BKUCommonGUI/pom.xml index 1cedb84d..3ae1717d 100644 --- a/BKUCommonGUI/pom.xml +++ b/BKUCommonGUI/pom.xml @@ -1,39 +1,38 @@ - - - - bku - at.gv.egiz - 1.0.0-SNAPSHOT - - 4.0.0 - at.gv.egiz - BKUCommonGUI - BKU Common GUI - 1.0.0-SNAPSHOT - - - at.gv.egiz - smcc - 1.0.0-SNAPSHOT - - - at.gv.egiz - STAL - 1.0.0-SNAPSHOT - compile - - - - - - maven-compiler-plugin - org.apache.maven.plugins - - false - - - - + + + bku + at.gv.egiz + 1.0.1 + + 4.0.0 + at.gv.egiz + BKUCommonGUI + BKU Common GUI + 1.0.1 + + + at.gv.egiz + smcc + 1.0.1 + + + at.gv.egiz + STAL + 1.0.1 + compile + + + + + + maven-compiler-plugin + org.apache.maven.plugins + + false + + + + - + + \ No newline at end of file diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index 54de31b2..3cf9b0cd 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -1,112 +1,111 @@ - - - - bku - at.gv.egiz - 1.0.0-SNAPSHOT - - 4.0.0 - at.gv.egiz - BKULocal - war - BKU Local - 1.0.0-SNAPSHOT - - - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal - - - - - maven-war-plugin - 2.0.2 - - - true - - - - ${project.version}-r${buildNumber} - - - - - - org.codehaus.mojo - maven-buildnumber-plugin - 0.9.6 - - - validate - - create - - - - - false - false - - - - - - - - at.gv.egiz - STAL - 1.0.0-SNAPSHOT - - - at.gv.egiz - bkucommon - 1.0.0-SNAPSHOT - - - at.gv.egiz - smcc - 1.0.0-SNAPSHOT - - - at.gv.egiz - smccSTAL - 1.0.0-SNAPSHOT - - - org.springframework - spring-core - 2.5.5 - - - javax.servlet - servlet-api - 2.5 - provided - - - org.springframework - spring-web - 2.5.5 - - - commons-logging - commons-logging - - - at.gv.egiz - BKUApplet - 1.0.0-SNAPSHOT - - - at.gv.egiz - BKUViewer - 1.0.0-SNAPSHOT - - - - - Tomcat60 - - + + + bku + at.gv.egiz + 1.0.1 + + 4.0.0 + at.gv.egiz + BKULocal + war + BKU Local + 1.0.1 + + + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.1/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.1/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.1/BKULocal + + + + + maven-war-plugin + 2.0.2 + + + true + + + + ${project.version}-r${buildNumber} + + + + + + org.codehaus.mojo + maven-buildnumber-plugin + 0.9.6 + + + validate + + create + + + + + false + false + + + + + + + + at.gv.egiz + STAL + 1.0.1 + + + at.gv.egiz + bkucommon + 1.0.1 + + + at.gv.egiz + smcc + 1.0.1 + + + at.gv.egiz + smccSTAL + 1.0.1 + + + org.springframework + spring-core + 2.5.5 + + + javax.servlet + servlet-api + 2.5 + provided + + + org.springframework + spring-web + 2.5.5 + + + commons-logging + commons-logging + + + at.gv.egiz + BKUApplet + 1.0.1 + + + at.gv.egiz + BKUViewer + 1.0.1 + + + + + Tomcat60 + + \ No newline at end of file diff --git a/BKULocalApp/pom.xml b/BKULocalApp/pom.xml index 4476f3b5..2a5b8d19 100644 --- a/BKULocalApp/pom.xml +++ b/BKULocalApp/pom.xml @@ -1,101 +1,100 @@ - - - bku - at.gv.egiz - 1.0.0-SNAPSHOT - - 4.0.0 - at.gv.egiz.bku - BKULocalApp - BKU Local App - 1.0.0-SNAPSHOT - - - - - - maven-compiler-plugin - org.apache.maven.plugins - 2.0.2 - - 1.6 - 1.6 - true - true - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - true - at.gv.egiz.bku.local.app.BKULauncher - - - development - ${pom.url} - splash.png - - - - - - maven-dependency-plugin - - - copy-dependencies - package - - copy-dependencies - - - ${project.build.directory} - false - false - true - - - - - - - - - - - commons-logging - commons-logging - 1.1.1 - compile - - - at.gv.egiz - BKULocal - 1.0.0-SNAPSHOT - war - - - utils - at.gv.egiz - 1.0.0-SNAPSHOT - compile - - - commons-cli - commons-cli - 1.0 - - - org.mortbay.jetty - jetty - 6.1.10 - - - + + + bku + at.gv.egiz + 1.0.1 + + 4.0.0 + at.gv.egiz.bku + BKULocalApp + BKU Local App + 1.0.1 + + + + + + maven-compiler-plugin + org.apache.maven.plugins + 2.0.2 + + 1.6 + 1.6 + true + true + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + true + at.gv.egiz.bku.local.app.BKULauncher + + + development + ${pom.url} + splash.png + + + + + + maven-dependency-plugin + + + copy-dependencies + package + + copy-dependencies + + + ${project.build.directory} + false + false + true + + + + + + + + + + + commons-logging + commons-logging + 1.1.1 + compile + + + at.gv.egiz + BKULocal + 1.0.1 + war + + + utils + at.gv.egiz + 1.0.1 + compile + + + commons-cli + commons-cli + 1.0 + + + org.mortbay.jetty + jetty + 6.1.10 + + + \ No newline at end of file diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index 0704cc12..7bee3a02 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -1,222 +1,219 @@ - - - - bku - at.gv.egiz - 1.0.0-SNAPSHOT - - 4.0.0 - at.gv.egiz - BKUOnline - war - BKU Online - 1.0.0-SNAPSHOT - - - - tlc - TLC Repository - http://commons.ucalgary.ca/pub/m2 - - - - - - at.gv.egiz - bkucommon - 1.0.0-SNAPSHOT - - - at.gv.egiz - BKUViewer - 1.0.0-SNAPSHOT - - - commons-logging - commons-logging - - - org.springframework - spring-core - 2.5.5 - - - javax.servlet - servlet-api - 2.5 - provided - - - org.springframework - spring-web - 2.5.5 - - - at.gv.egiz - STALService - 1.0.0-SNAPSHOT - compile - - - - at.gv.egiz - BKUApplet - 1.0.0-SNAPSHOT - provided - - - at.gv.egiz - STALService - 1.0.0-SNAPSHOT - - - - - com.sun.xml.ws - jaxws-rt - 2.1.4 - - - - - - Tomcat60 - - - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKUOnline - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKUOnline - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKUOnline - - - - - maven-dependency-plugin - - - copyapplet-dependencies - - copy-dependencies - - - ${project.build.directory}/${project.build.finalName}/applet - - at.gv.egiz - BKUApplet - true - - - - copyapplet - - copy - - - ${project.build.directory}/${project.build.finalName}/applet - - - commons-logging - commons-logging - - - iaik - iaik_jce_me4se - - - - - - - - - - maven-war-plugin - 2.0.2 - - - - true - - - - - - ${project.version}-r${buildNumber} - - - - - - - org.codehaus.mojo - maven-buildnumber-plugin - 0.9.6 - - - validate - - create - - - - - false - false - - - - - + + + bku + at.gv.egiz + 1.0.1 + + 4.0.0 + at.gv.egiz + BKUOnline + war + BKU Online + 1.0.1 + + + + tlc + TLC Repository + http://commons.ucalgary.ca/pub/m2 + + + + + + at.gv.egiz + bkucommon + 1.0.1 + + + at.gv.egiz + BKUViewer + 1.0.1 + + + commons-logging + commons-logging + + + org.springframework + spring-core + 2.5.5 + + + javax.servlet + servlet-api + 2.5 + provided + + + org.springframework + spring-web + 2.5.5 + + + at.gv.egiz + STALService + 1.0.1 + compile + + + + at.gv.egiz + BKUApplet + 1.0.1 + provided + + + at.gv.egiz + STALService + 1.0.1 + + + + + com.sun.xml.ws + jaxws-rt + 2.1.4 + + + + + + Tomcat60 + + + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.1/BKUOnline + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.1/BKUOnline + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.1/BKUOnline + + + + + maven-dependency-plugin + + + copyapplet-dependencies + + copy-dependencies + + + ${project.build.directory}/${project.build.finalName}/applet + + at.gv.egiz + BKUApplet + true + + + + copyapplet + + copy + + + ${project.build.directory}/${project.build.finalName}/applet + + + commons-logging + commons-logging + + + iaik + iaik_jce_me4se + + + + + + + + + + maven-war-plugin + 2.0.2 + + + + true + + + + + + ${project.version}-r${buildNumber} + + + + + + + org.codehaus.mojo + maven-buildnumber-plugin + 0.9.6 + + + validate + + create + + + + + false + false + + + + + \ No newline at end of file diff --git a/BKUViewer/pom.xml b/BKUViewer/pom.xml index 5af7c057..2af2a6cf 100644 --- a/BKUViewer/pom.xml +++ b/BKUViewer/pom.xml @@ -1,21 +1,20 @@ - + bku at.gv.egiz - 1.0.0-SNAPSHOT + 1.0.1 4.0.0 at.gv.egiz BKUViewer BKU viewer components - 1.0.0-SNAPSHOT + 1.0.1 at.gv.egiz bkucommon - 1.0.0-SNAPSHOT + 1.0.1 commons-logging diff --git a/STAL/pom.xml b/STAL/pom.xml index 884c86a2..a1e76cd7 100644 --- a/STAL/pom.xml +++ b/STAL/pom.xml @@ -1,15 +1,15 @@ - + bku at.gv.egiz - 1.0.0-SNAPSHOT + 1.0.1 4.0.0 at.gv.egiz STAL STAL - 1.0.0-SNAPSHOT + 1.0.1 commons-logging diff --git a/STALService/pom.xml b/STALService/pom.xml index aa8ce064..51d2c6d8 100644 --- a/STALService/pom.xml +++ b/STALService/pom.xml @@ -1,22 +1,21 @@ - + bku at.gv.egiz - 1.0.0-SNAPSHOT + 1.0.1 4.0.0 at.gv.egiz STALService STAL Service - 1.0.0-SNAPSHOT + 1.0.1 at.gv.egiz STAL - 1.0.0-SNAPSHOT + 1.0.1 + true + true \ No newline at end of file diff --git a/pom.xml b/pom.xml index 39528296..cc8387db 100644 --- a/pom.xml +++ b/pom.xml @@ -1,231 +1,224 @@ - - - 4.0.0 - at.gv.egiz - bku - pom - 1.0.0-SNAPSHOT - BKU - http://bku.egiz.gv.at - - utils - bkucommon - STAL - BKUOnline - smcc - BKULocal - BKUApplet - smccSTAL - STALService - BKUCommonGUI - BKUViewer - BKULocalApp - - - - mcentner - Martin Centner - mcentner@egiz.gv.at - - - wbauer - Wolfgang Bauer - wbauer@egiz.gv.at - - - corthacker - Clemens Orthacker - corthacker@egiz.gv.at - - - - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk - scm:svn:svn+ssh://svn.egovlabs.gv.at/svnroot/mocca/trunk - svn://svn.egovlabs.gv.at/svnroot/mocca/trunk - - - E-Government Innovation Center (EGIZ) - http://www.egiz.gv.at - - - - - - maven-compiler-plugin - org.apache.maven.plugins - 2.0.2 - - - 1.6 - 1.6 - true - true - UTF-8 - - - - maven-resources-plugin - - UTF-8 - - - - maven-assembly-plugin - org.apache.maven.plugins - 2.2-beta-2 - - - maven-dependency-plugin - org.apache.maven.plugins - 2.0 - - - - jaxws-maven-plugin - org.codehaus.mojo - 1.10 - - - org.apache.maven.plugins - maven-release-plugin - 2.0-beta-7 - - - - - - maven-assembly-plugin - - - ${basedir}/src/main/assemblies/assembly-test.xml - - - - - - - - - - mocca-egovlabs - MOCCA EGovLabs - http://mocca.egovlabs.gv.at/m2/repository/ - - - maven2-repository.dev.java.net - Java.net Repository for Maven 2 - http://download.java.net/maven/2/ - - - maven1-repository.dev.java.net - Java.net Repository for Maven 1 - http://download.java.net/maven/1/ - legacy - - - - - log4j - log4j - runtime - - - junit - junit - test - - - - - - log4j - log4j - 1.2.12 - runtime - - - commons-logging - commons-logging - 1.1.1 - compile - - - junit - junit - 4.4 - test - - - xerces - xercesImpl - 2.9.1 - - - xalan - xalan - 2.7.0 - - - iaik - iaik_jce_full_signed - 3.16 - compile - - - iaik - iaik_jce_me4se - 3.04 - - - iaik - iaik_ecc_signed - 2.15 - - - iaik - iaik_xsect - 1.14 - - - iaik - iaik_pki - 1.0-MOCCA - compile - - - commons-fileupload - commons-fileupload - 1.2.1 - compile - - - commons-httpclient - commons-httpclient - 3.1 - compile - - - + + 4.0.0 + at.gv.egiz + bku + pom + 1.0.1 + BKU + http://bku.egiz.gv.at + + utils + bkucommon + STAL + BKUOnline + smcc + BKULocal + BKUApplet + smccSTAL + STALService + BKUCommonGUI + BKUViewer + BKULocalApp + + + + mcentner + Martin Centner + mcentner@egiz.gv.at + + + wbauer + Wolfgang Bauer + wbauer@egiz.gv.at + + + corthacker + Clemens Orthacker + corthacker@egiz.gv.at + + + + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.1 + scm:svn:svn+ssh://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.1 + svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.1 + + + E-Government Innovation Center (EGIZ) + http://www.egiz.gv.at + + + + + + maven-compiler-plugin + org.apache.maven.plugins + 2.0.2 + + + 1.6 + 1.6 + true + true + UTF-8 + + + + maven-resources-plugin + + UTF-8 + + + + maven-assembly-plugin + org.apache.maven.plugins + 2.2-beta-2 + + + maven-dependency-plugin + org.apache.maven.plugins + 2.0 + + + + jaxws-maven-plugin + org.codehaus.mojo + 1.10 + + + org.apache.maven.plugins + maven-release-plugin + 2.0-beta-7 + + + + + + maven-assembly-plugin + + + ${basedir}/src/main/assemblies/assembly-test.xml + + + + + + + + + + mocca-egovlabs + MOCCA EGovLabs + http://mocca.egovlabs.gv.at/m2/repository/ + + + maven2-repository.dev.java.net + Java.net Repository for Maven 2 + http://download.java.net/maven/2/ + + + maven1-repository.dev.java.net + Java.net Repository for Maven 1 + http://download.java.net/maven/1/ + legacy + + + + + log4j + log4j + runtime + + + junit + junit + test + + + + + + log4j + log4j + 1.2.12 + runtime + + + commons-logging + commons-logging + 1.1.1 + compile + + + junit + junit + 4.4 + test + + + xerces + xercesImpl + 2.9.1 + + + xalan + xalan + 2.7.0 + + + iaik + iaik_jce_full_signed + 3.16 + compile + + + iaik + iaik_jce_me4se + 3.04 + + + iaik + iaik_ecc_signed + 2.15 + + + iaik + iaik_xsect + 1.14 + + + iaik + iaik_pki + 1.0-MOCCA + compile + + + commons-fileupload + commons-fileupload + 1.2.1 + compile + + + commons-httpclient + commons-httpclient + 3.1 + compile + + + \ No newline at end of file diff --git a/smcc/pom.xml b/smcc/pom.xml index ba1ffcce..ffdba367 100644 --- a/smcc/pom.xml +++ b/smcc/pom.xml @@ -1,43 +1,42 @@ - - - - bku - at.gv.egiz - 1.0.0-SNAPSHOT - - 4.0.0 - at.gv.egiz - smcc - smcc - jar - 1.0.0-SNAPSHOT - http://bku.egiz.gv.at - - - - maven-compiler-plugin - org.apache.maven.plugins - - false - - - - - - - commons-logging - commons-logging - - - junit - junit - 3.8.1 - test - - - - + + + bku + at.gv.egiz + 1.0.1 + + 4.0.0 + at.gv.egiz + smcc + smcc + jar + 1.0.1 + http://bku.egiz.gv.at + + + + maven-compiler-plugin + org.apache.maven.plugins + + false + + + + + + + commons-logging + commons-logging + + + junit + junit + 3.8.1 + test + + + + \ No newline at end of file diff --git a/smccSTAL/pom.xml b/smccSTAL/pom.xml index 78ba1aea..6729f3f0 100644 --- a/smccSTAL/pom.xml +++ b/smccSTAL/pom.xml @@ -1,50 +1,48 @@ - - - - bku - at.gv.egiz - 1.0.0-SNAPSHOT - - 4.0.0 - at.gv.egiz - smccSTAL - smcc STAL - 1.0.0-SNAPSHOT - - - - maven-compiler-plugin - org.apache.maven.plugins - - false - - - - - - - at.gv.egiz - STAL - 1.0.0-SNAPSHOT - - - at.gv.egiz - smcc - 1.0.0-SNAPSHOT - - - at.gv.egiz - BKUCommonGUI - 1.0.0-SNAPSHOT - - - iaik - iaik_jce_me4se - - - commons-logging - commons-logging - - + + + bku + at.gv.egiz + 1.0.1 + + 4.0.0 + at.gv.egiz + smccSTAL + smcc STAL + 1.0.1 + + + + maven-compiler-plugin + org.apache.maven.plugins + + false + + + + + + + at.gv.egiz + STAL + 1.0.1 + + + at.gv.egiz + smcc + 1.0.1 + + + at.gv.egiz + BKUCommonGUI + 1.0.1 + + + iaik + iaik_jce_me4se + + + commons-logging + commons-logging + + \ No newline at end of file diff --git a/utils/pom.xml b/utils/pom.xml index 871dbb0a..b0769293 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -1,77 +1,72 @@ - - - - bku - at.gv.egiz - 1.0.0-SNAPSHOT - - 4.0.0 - at.gv.egiz - utils - BKU Utils - jar - 1.0.0-SNAPSHOT - http://bku.egiz.gv.at - - - - - - - - commons-logging - commons-logging - - - iaik - iaik_jce_full_signed - - - iaik - iaik_ecc_signed - - - iaik - iaik_xsect - - - - - + + + bku + at.gv.egiz + 1.0.1 + + 4.0.0 + at.gv.egiz + utils + BKU Utils + jar + 1.0.1 + http://bku.egiz.gv.at + + + + + + + + commons-logging + commons-logging + + + iaik + iaik_jce_full_signed + + + iaik + iaik_ecc_signed + + + iaik + iaik_xsect + + + + + \ No newline at end of file -- cgit v1.2.3 From 86962d8745b41a6cdb9fd95496176e698c0f6a9c Mon Sep 17 00:00:00 2001 From: mcentner Date: Tue, 25 Nov 2008 07:47:48 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@203 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/pom.xml | 14 +++++++------- BKUCommonGUI/pom.xml | 8 ++++---- BKULocal/pom.xml | 22 +++++++++++----------- BKULocalApp/pom.xml | 8 ++++---- BKUOnline/pom.xml | 20 ++++++++++---------- BKUViewer/pom.xml | 6 +++--- STAL/pom.xml | 4 ++-- STALService/pom.xml | 6 +++--- bkucommon/pom.xml | 8 ++++---- pom.xml | 8 ++++---- smcc/pom.xml | 4 ++-- smccSTAL/pom.xml | 10 +++++----- utils/pom.xml | 4 ++-- 13 files changed, 61 insertions(+), 61 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml index 6f900ad3..1d880919 100644 --- a/BKUApplet/pom.xml +++ b/BKUApplet/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.1 + 1.0.1-SNAPSHOT 4.0.0 at.gv.egiz BKUApplet BKU Applet - 1.0.1 + 1.0.1-SNAPSHOT @@ -117,27 +117,27 @@ at.gv.egiz smcc - 1.0.1 + 1.0.1-SNAPSHOT at.gv.egiz STAL - 1.0.1 + 1.0.1-SNAPSHOT at.gv.egiz STALService - 1.0.1 + 1.0.1-SNAPSHOT at.gv.egiz smccSTAL - 1.0.1 + 1.0.1-SNAPSHOT at.gv.egiz BKUCommonGUI - 1.0.1 + 1.0.1-SNAPSHOT commons-logging diff --git a/BKUCommonGUI/pom.xml b/BKUCommonGUI/pom.xml index 3ae1717d..21518416 100644 --- a/BKUCommonGUI/pom.xml +++ b/BKUCommonGUI/pom.xml @@ -2,23 +2,23 @@ bku at.gv.egiz - 1.0.1 + 1.0.1-SNAPSHOT 4.0.0 at.gv.egiz BKUCommonGUI BKU Common GUI - 1.0.1 + 1.0.1-SNAPSHOT at.gv.egiz smcc - 1.0.1 + 1.0.1-SNAPSHOT at.gv.egiz STAL - 1.0.1 + 1.0.1-SNAPSHOT compile diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index 3cf9b0cd..9fe36269 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -2,19 +2,19 @@ bku at.gv.egiz - 1.0.1 + 1.0.1-SNAPSHOT 4.0.0 at.gv.egiz BKULocal war BKU Local - 1.0.1 + 1.0.1-SNAPSHOT - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.1/BKULocal - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.1/BKULocal - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.1/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal @@ -56,22 +56,22 @@ at.gv.egiz STAL - 1.0.1 + 1.0.1-SNAPSHOT at.gv.egiz bkucommon - 1.0.1 + 1.0.1-SNAPSHOT at.gv.egiz smcc - 1.0.1 + 1.0.1-SNAPSHOT at.gv.egiz smccSTAL - 1.0.1 + 1.0.1-SNAPSHOT org.springframework @@ -96,12 +96,12 @@ at.gv.egiz BKUApplet - 1.0.1 + 1.0.1-SNAPSHOT at.gv.egiz BKUViewer - 1.0.1 + 1.0.1-SNAPSHOT diff --git a/BKULocalApp/pom.xml b/BKULocalApp/pom.xml index 2a5b8d19..c0d406b3 100644 --- a/BKULocalApp/pom.xml +++ b/BKULocalApp/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.1 + 1.0.1-SNAPSHOT 4.0.0 at.gv.egiz.bku BKULocalApp BKU Local App - 1.0.1 + 1.0.1-SNAPSHOT @@ -76,13 +76,13 @@ at.gv.egiz BKULocal - 1.0.1 + 1.0.1-SNAPSHOT war utils at.gv.egiz - 1.0.1 + 1.0.1-SNAPSHOT compile diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index 7bee3a02..88cdf9e8 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -2,14 +2,14 @@ bku at.gv.egiz - 1.0.1 + 1.0.1-SNAPSHOT 4.0.0 at.gv.egiz BKUOnline war BKU Online - 1.0.1 + 1.0.1-SNAPSHOT @@ -23,12 +23,12 @@ at.gv.egiz bkucommon - 1.0.1 + 1.0.1-SNAPSHOT at.gv.egiz BKUViewer - 1.0.1 + 1.0.1-SNAPSHOT commons-logging @@ -53,20 +53,20 @@ at.gv.egiz STALService - 1.0.1 + 1.0.1-SNAPSHOT compile at.gv.egiz BKUApplet - 1.0.1 + 1.0.1-SNAPSHOT provided at.gv.egiz STALService - 1.0.1 + 1.0.1-SNAPSHOT at.gv.egiz BKUApplet - 1.0.1-SNAPSHOT + 1.0.2 provided at.gv.egiz STALService - 1.0.1-SNAPSHOT + 1.0.2 at.gv.egiz BKUApplet - 1.0.2 + 1.0.2-SNAPSHOT provided at.gv.egiz STALService - 1.0.2 + 1.0.2-SNAPSHOT at.gv.egiz BKUApplet - 1.0.2-SNAPSHOT + 1.0.1-SNAPSHOT provided at.gv.egiz STALService - 1.0.2-SNAPSHOT + 1.0.1-SNAPSHOT at.gv.egiz BKUApplet - 1.0.1-SNAPSHOT + 1.0.1 provided at.gv.egiz STALService - 1.0.1-SNAPSHOT + 1.0.1 at.gv.egiz BKUApplet - 1.0.1 + 1.0.1-SNAPSHOT provided at.gv.egiz STALService - 1.0.1 + 1.0.1-SNAPSHOT at.gv.egiz BKUApplet - 1.0.1-SNAPSHOT + 1.0.1 provided at.gv.egiz STALService - 1.0.1-SNAPSHOT + 1.0.1 at.gv.egiz BKUApplet - 1.0.1 + 1.0.2-SNAPSHOT provided at.gv.egiz STALService - 1.0.1 + 1.0.2-SNAPSHOT -- cgit v1.2.3 From b7a21dac485edf28d6201ab210d7263cf052e21f Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 1 Dec 2008 12:39:54 +0000 Subject: cleanup git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@226 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'BKUApplet') 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 d0eed607..d0f6d489 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 @@ -75,7 +75,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { /** * Factory method to create and wire HelpListener, GUI and BKUWorker. - * (Config via applet parameters as constants BKUApplet.*) + * (Config via applet parameters, see BKUApplet.* constants) */ @Override public void init() { @@ -83,7 +83,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { log.debug("Called init()"); HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance()); - + String locale = getAppletParameter(LOCALE); if (locale != null) { this.setLocale(new Locale(locale)); -- cgit v1.2.3 From 77a19e106e4128c21dd2d1270fdc8d930e415247 Mon Sep 17 00:00:00 2001 From: wbauer Date: Thu, 18 Dec 2008 08:58:39 +0000 Subject: Fixed BUG #366, changed applet name in BKUOnline to have no version number git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@253 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../gv/egiz/bku/online/applet/AppletBKUWorker.java | 59 ++++-- .../online/applet/InternalSSLSocketFactory.java | 235 +++++++++++---------- .../conf/certs/CACerts/A-CERT GLOBALTRUST.cer | Bin 0 -> 1561 bytes .../local/conf/certs/certStore/A-CERT ADVANCED.cer | Bin 0 -> 1751 bytes .../conf/certs/certStore/A-CERT GLOBALTRUST.cer | Bin 0 -> 1561 bytes .../conf/certs/certStore/A-Trust-Qual-01a.cer | Bin 0 -> 1111 bytes .../conf/certs/certStore/A-Trust-Qual-02a.cer | Bin 0 -> 975 bytes .../conf/certs/certStore/A-Trust-Qual-03a.cer | Bin 0 -> 975 bytes .../conf/certs/certStore/A-Trust-nQual-01a.cer | Bin 0 -> 865 bytes .../conf/certs/certStore/A-Trust-nQual-03.cer | Bin 0 -> 979 bytes BKUOnline/pom.xml | 1 + .../egiz/bku/online/webapp/BKURequestHandler.java | 60 ++++-- .../webapp/applet/BKUApplet-1.0.2-SNAPSHOT.jar | Bin 182140 -> 0 bytes BKUOnline/src/main/webapp/appletPage.jsp | 2 +- .../accesscontroller/AuthenticationClassifier.java | 3 +- .../test/java/at/gv/egiz/smcc/SMCCApplication.java | 49 ----- .../test/java/at/gv/egiz/smcc/STARCOSCardTest.java | 121 ----------- smcc/src/test/java/at/gv/egiz/smcc/SWCardTest.java | 66 ------ 18 files changed, 197 insertions(+), 399 deletions(-) create mode 100644 BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/CACerts/A-CERT GLOBALTRUST.cer create mode 100644 BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-CERT ADVANCED.cer create mode 100644 BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-CERT GLOBALTRUST.cer create mode 100644 BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-Qual-01a.cer create mode 100644 BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-Qual-02a.cer create mode 100644 BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-Qual-03a.cer create mode 100644 BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-nQual-01a.cer create mode 100644 BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-nQual-03.cer delete mode 100644 BKUOnline/src/main/webapp/applet/BKUApplet-1.0.2-SNAPSHOT.jar delete mode 100644 smcc/src/test/java/at/gv/egiz/smcc/SMCCApplication.java delete mode 100644 smcc/src/test/java/at/gv/egiz/smcc/STARCOSCardTest.java delete mode 100644 smcc/src/test/java/at/gv/egiz/smcc/SWCardTest.java (limited to 'BKUApplet') diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java index 03e4b7c9..9fc21df8 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java @@ -38,7 +38,7 @@ import java.util.List; import javax.xml.namespace.QName; /** - * + * * @author Clemens Orthacker */ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { @@ -48,7 +48,8 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { protected String sessionId; protected STALPortType stalPort; - public AppletBKUWorker(BKUGUIFacade gui, AppletContext ctx, AppletParameterProvider paramProvider) { + public AppletBKUWorker(BKUGUIFacade gui, AppletContext ctx, + AppletParameterProvider paramProvider) { super(gui); if (ctx == null) { throw new NullPointerException("Applet context not provided"); @@ -76,7 +77,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { actionCommandList.clear(); actionCommandList.add("ok"); gui.showErrorDialog(BKUGUIFacade.ERR_SERVICE_UNREACHABLE, - new Object[]{e.getMessage()}); + new Object[] { e.getMessage() }); try { waitForAction(); } catch (InterruptedException e1) { @@ -92,8 +93,10 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { GetNextRequestResponseType nextRequestResp = stalPort.connect(sessionId); do { - List requests = nextRequestResp.getInfoboxReadRequestOrSignRequestOrQuitRequest(); - List stalRequests = STALTranslator.translateRequests(requests); + List requests = nextRequestResp + .getInfoboxReadRequestOrSignRequestOrQuitRequest(); + List stalRequests = STALTranslator + .translateRequests(requests); if (log.isInfoEnabled()) { StringBuilder sb = new StringBuilder("Received "); @@ -142,64 +145,76 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { } if (!finished) { - log.info("Not finished yet (BKUWorker: " + this + "), sending responses"); + log.info("Not finished yet (BKUWorker: " + this + + "), sending responses"); GetNextRequestType nextRequest = of.createGetNextRequestType(); nextRequest.setSessionId(sessionId); - nextRequest.getInfoboxReadResponseOrSignResponseOrErrorResponse().addAll(responses); + nextRequest.getInfoboxReadResponseOrSignResponseOrErrorResponse() + .addAll(responses); nextRequestResp = stalPort.getNextRequest(nextRequest); } } while (!finished); log.info("Done " + Thread.currentThread().getName()); } catch (Exception ex) { log.error(ex.getMessage(), ex); - gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[]{ex.getMessage()}); + gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] { ex + .getMessage() }); try { waitForAction(); } catch (InterruptedException e) { log.error(e); } - } - if (signatureCard != null) { - signatureCard.disconnect(false); + if (signatureCard != null) { + signatureCard.disconnect(false); + } } sendRedirect(); } protected void sendRedirect() { try { - URL redirectURL = params.getURLParameter(BKUApplet.REDIRECT_URL, sessionId); - String redirectTarget = params.getAppletParameter(BKUApplet.REDIRECT_TARGET); + URL redirectURL = params.getURLParameter(BKUApplet.REDIRECT_URL, + sessionId); + String redirectTarget = params + .getAppletParameter(BKUApplet.REDIRECT_TARGET); if (redirectTarget == null) { log.info("Done. Redirecting to " + redirectURL + " ..."); ctx.showDocument(redirectURL); } else { - log.info("Done. Redirecting to " + redirectURL + " (target=" + redirectTarget + ") ..."); + log.info("Done. Redirecting to " + redirectURL + " (target=" + + redirectTarget + ") ..."); ctx.showDocument(redirectURL, redirectTarget); } } catch (MalformedURLException ex) { log.warn("Failed to redirect: " + ex.getMessage(), ex); - // gui.showErrorDialog(errorMsg, okListener, actionCommand) + // gui.showErrorDialog(errorMsg, okListener, actionCommand) } } private STALPortType getSTALPort() throws MalformedURLException { URL wsdlURL = params.getURLParameter(BKUApplet.WSDL_URL); log.debug("STAL WSDL at " + wsdlURL); - QName endpointName = new QName(BKUApplet.STAL_WSDL_NS, BKUApplet.STAL_SERVICE); + QName endpointName = new QName(BKUApplet.STAL_WSDL_NS, + BKUApplet.STAL_SERVICE); STALService stal = new STALService(wsdlURL, endpointName); return stal.getSTALPort(); } private void registerSignRequestHandler() throws MalformedURLException { - String hashDataDisplayStyle = params.getAppletParameter(BKUApplet.HASHDATA_DISPLAY); + String hashDataDisplayStyle = params + .getAppletParameter(BKUApplet.HASHDATA_DISPLAY); if (BKUApplet.HASHDATA_DISPLAY_BROWSER.equals(hashDataDisplayStyle)) { - URL hashDataURL = params.getURLParameter(BKUApplet.HASHDATA_URL, sessionId); + URL hashDataURL = params.getURLParameter(BKUApplet.HASHDATA_URL, + sessionId); log.debug("register SignRequestHandler for HashDataURL " + hashDataURL); - addRequestHandler(SignRequest.class, new BrowserHashDataDisplay(ctx, hashDataURL)); + addRequestHandler(SignRequest.class, new BrowserHashDataDisplay(ctx, + hashDataURL)); } else { - //BKUApplet.HASHDATA_DISPLAY_FRAME - log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL); - AppletHashDataDisplay handler = new AppletHashDataDisplay(stalPort, sessionId); + // BKUApplet.HASHDATA_DISPLAY_FRAME + log.debug("register SignRequestHandler for STAL port " + + BKUApplet.WSDL_URL); + AppletHashDataDisplay handler = new AppletHashDataDisplay(stalPort, + sessionId); addRequestHandler(SignRequest.class, handler); } } diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java index c3417d63..a02e56eb 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java @@ -36,121 +36,122 @@ import org.apache.commons.logging.LogFactory; public class InternalSSLSocketFactory extends SSLSocketFactory { - private final static String GOV_DOMAIN = ".gv.at"; - - private static InternalSSLSocketFactory instance = new InternalSSLSocketFactory(); - - private final static Log log = LogFactory - .getLog(InternalSSLSocketFactory.class); - - private SSLSocket sslSocket; - - private SSLSocketFactory proxy; - - private InternalSSLSocketFactory() { - proxy = HttpsURLConnection.getDefaultSSLSocketFactory(); - } - - public static InternalSSLSocketFactory getInstance() { - return instance; - } - - @Override - public Socket createSocket() throws IOException { - sslSocket = (SSLSocket) proxy.createSocket(); - return sslSocket; - } - - @Override - public Socket createSocket(String arg0, int arg1) throws IOException, - UnknownHostException { - sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1); - - return sslSocket; - } - - @Override - public Socket createSocket(InetAddress arg0, int arg1) throws IOException { - sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1); - return sslSocket; - } - - @Override - public Socket createSocket(String arg0, int arg1, InetAddress arg2, int arg3) - throws IOException, UnknownHostException { - sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1, arg2, arg3); - return sslSocket; - } - - @Override - public Socket createSocket(InetAddress arg0, int arg1, InetAddress arg2, - int arg3) throws IOException { - sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1, arg2, arg3); - return sslSocket; - } - - @Override - public Socket createSocket(Socket arg0, String arg1, int arg2, boolean arg3) - throws IOException { - sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1, arg2, arg3); - return sslSocket; - } - - @Override - public String[] getDefaultCipherSuites() { - return proxy.getDefaultCipherSuites(); - } - - @Override - public String[] getSupportedCipherSuites() { - return proxy.getSupportedCipherSuites(); - } - - public boolean isEgovAgency() { - log.info("Checking if server is egov agency"); - if (sslSocket != null) { - try { - X509Certificate cert = (X509Certificate) sslSocket.getSession() - .getPeerCertificates()[0]; - log.info("Server cert: " + cert); - return isGovAgency(cert); - } catch (SSLPeerUnverifiedException e) { - log.error(e); - return false; - } - } - log.info("Not a SSL connection"); - return false; - } - - public static boolean isGovAgency(X509Certificate cert) { - String[] rdns = (cert.getSubjectX500Principal().getName()).split(","); - for (String rdn : rdns) { - if (rdn.startsWith("CN=")) { - String dns = rdn.split("=")[1]; - if (dns.endsWith(GOV_DOMAIN)) { - return true; - } - } - } - try { - Collection> sanList = cert.getSubjectAlternativeNames(); - if (sanList != null) { - for (List san : sanList) { - if ((Integer) san.get(0) == 2) { - String dns = (String) san.get(1); - if (dns.endsWith(GOV_DOMAIN)) { - return true; - } - } - } - } - } catch (CertificateParsingException e) { - log.error(e); - } - if (cert.getExtensionValue("1.2.40.0.10.1.1.1") != null) { - return true; - } - return false; - } + private final static String GOV_DOMAIN = ".gv.at"; + + private static InternalSSLSocketFactory instance = new InternalSSLSocketFactory(); + + private final static Log log = LogFactory + .getLog(InternalSSLSocketFactory.class); + + private SSLSocket sslSocket; + + private SSLSocketFactory proxy; + + private InternalSSLSocketFactory() { + proxy = HttpsURLConnection.getDefaultSSLSocketFactory(); + } + + public static InternalSSLSocketFactory getInstance() { + return instance; + } + + @Override + public Socket createSocket() throws IOException { + sslSocket = (SSLSocket) proxy.createSocket(); + return sslSocket; + } + + @Override + public Socket createSocket(String arg0, int arg1) throws IOException, + UnknownHostException { + sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1); + + return sslSocket; + } + + @Override + public Socket createSocket(InetAddress arg0, int arg1) throws IOException { + sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1); + return sslSocket; + } + + @Override + public Socket createSocket(String arg0, int arg1, InetAddress arg2, int arg3) + throws IOException, UnknownHostException { + sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1, arg2, arg3); + return sslSocket; + } + + @Override + public Socket createSocket(InetAddress arg0, int arg1, InetAddress arg2, + int arg3) throws IOException { + sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1, arg2, arg3); + return sslSocket; + } + + @Override + public Socket createSocket(Socket arg0, String arg1, int arg2, boolean arg3) + throws IOException { + sslSocket = (SSLSocket) proxy.createSocket(arg0, arg1, arg2, arg3); + return sslSocket; + } + + @Override + public String[] getDefaultCipherSuites() { + return proxy.getDefaultCipherSuites(); + } + + @Override + public String[] getSupportedCipherSuites() { + return proxy.getSupportedCipherSuites(); + } + + public boolean isEgovAgency() { + log.info("Checking if server is egov agency"); + if (sslSocket != null) { + try { + X509Certificate cert = (X509Certificate) sslSocket.getSession() + .getPeerCertificates()[0]; + log.info("Server cert: " + cert); + return isGovAgency(cert); + } catch (SSLPeerUnverifiedException e) { + log.error(e); + return false; + } + } + log.info("Not a SSL connection"); + return false; + } + + public static boolean isGovAgency(X509Certificate cert) { + String[] rdns = (cert.getSubjectX500Principal().getName()).split(","); + for (String rdn : rdns) { + if (rdn.startsWith("CN=")) { + String dns = rdn.split("=")[1]; + if (dns.endsWith(GOV_DOMAIN)) { + return true; + } + } + } + try { + Collection> sanList = cert.getSubjectAlternativeNames(); + if (sanList != null) { + for (List san : sanList) { + if ((Integer) san.get(0) == 2) { + String dns = (String) san.get(1); + if (dns.endsWith(GOV_DOMAIN)) { + return true; + } + } + } + } + } catch (CertificateParsingException e) { + log.error(e); + } + if ((cert.getExtensionValue("1.2.40.0.10.1.1.1") != null) + || (cert.getExtensionValue("1.2.40.0.10.1.1.2") != null)) { + return true; + } + return false; + } } diff --git a/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/CACerts/A-CERT GLOBALTRUST.cer b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/CACerts/A-CERT GLOBALTRUST.cer new file mode 100644 index 00000000..9a25e57d Binary files /dev/null and b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/CACerts/A-CERT GLOBALTRUST.cer differ diff --git a/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-CERT ADVANCED.cer b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-CERT ADVANCED.cer new file mode 100644 index 00000000..66ff251b Binary files /dev/null and b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-CERT ADVANCED.cer differ diff --git a/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-CERT GLOBALTRUST.cer b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-CERT GLOBALTRUST.cer new file mode 100644 index 00000000..9a25e57d Binary files /dev/null and b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-CERT GLOBALTRUST.cer differ diff --git a/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-Qual-01a.cer b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-Qual-01a.cer new file mode 100644 index 00000000..f9fef65f Binary files /dev/null and b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-Qual-01a.cer differ diff --git a/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-Qual-02a.cer b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-Qual-02a.cer new file mode 100644 index 00000000..36a442b8 Binary files /dev/null and b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-Qual-02a.cer differ diff --git a/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-Qual-03a.cer b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-Qual-03a.cer new file mode 100644 index 00000000..ab9e0cd7 Binary files /dev/null and b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-Qual-03a.cer differ diff --git a/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-nQual-01a.cer b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-nQual-01a.cer new file mode 100644 index 00000000..efa28178 Binary files /dev/null and b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-nQual-01a.cer differ diff --git a/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-nQual-03.cer b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-nQual-03.cer new file mode 100644 index 00000000..33e77636 Binary files /dev/null and b/BKULocal/src/main/resources/at/gv/egiz/bku/local/conf/certs/certStore/A-Trust-nQual-03.cer differ diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index 1ea2c1a1..5e6ac8ad 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -121,6 +121,7 @@ --> at.gv.egiz BKUApplet + true true diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java index 3aa6bc19..12166a5a 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java @@ -24,6 +24,7 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; +import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -32,12 +33,12 @@ import javax.servlet.http.HttpSession; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import at.gv.egiz.bku.binding.BindingProcessor; import at.gv.egiz.bku.binding.HTTPBindingProcessor; import at.gv.egiz.bku.binding.HttpUtil; import at.gv.egiz.bku.binding.IdFactory; import at.gv.egiz.bku.utils.StreamUtil; import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage; -import javax.servlet.RequestDispatcher; /** * Handles SL requests and instantiates BindingProcessors @@ -52,7 +53,8 @@ public class BKURequestHandler extends SpringBKUServlet { protected Log log = LogFactory.getLog(BKURequestHandler.class); - private static String getStringFromStream(InputStream is, String encoding) throws IOException { + private static String getStringFromStream(InputStream is, String encoding) + throws IOException { if (is == null) { return null; } @@ -63,8 +65,7 @@ public class BKURequestHandler extends SpringBKUServlet { StreamUtil.copyStream(is, os); return new String(os.toByteArray(), encoding); } - - + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, java.io.IOException { log.debug("Got new request"); @@ -75,21 +76,28 @@ public class BKURequestHandler extends SpringBKUServlet { HttpSession session = req.getSession(false); if (session != null) { log.warn("Already a session with id: " + session.getId() - + " active, continuing"); - RequestDispatcher dispatcher = getServletContext().getNamedDispatcher(BKU_APPLET_JSP); - log.debug("forward to applet"); - dispatcher.forward(req, resp); - return; + + " active, trying to get Bindingprocessor"); + BindingProcessor bp = getBindingProcessorManager().getBindingProcessor( + IdFactory.getInstance().createId(session.getId())); + if (bp != null) { + log.debug("Found binding processor, using this one"); + RequestDispatcher dispatcher = getServletContext().getNamedDispatcher( + BKU_APPLET_JSP); + log.debug("forward to applet"); + dispatcher.forward(req, resp); + return; + } + log.debug("Did not find a binding processor, creating new ..."); } session = req.getSession(true); if (log.isDebugEnabled()) { log.debug("Using session id: " + session.getId()); } - - HTTPBindingProcessor bindingProcessor; + HTTPBindingProcessor bindingProcessor; bindingProcessor = (HTTPBindingProcessor) getBindingProcessorManager() - .createBindingProcessor(req.getRequestURL().toString(), session.getId(), locale); + .createBindingProcessor(req.getRequestURL().toString(), + session.getId(), locale); Map headerMap = new HashMap(); for (Enumeration headerName = req.getHeaderNames(); headerName @@ -109,14 +117,20 @@ public class BKURequestHandler extends SpringBKUServlet { bindingProcessor.consumeRequestStream(req.getInputStream()); req.getInputStream().close(); getBindingProcessorManager().process(bindingProcessor); - + log.trace("Trying to find applet parameters in request"); - String width = getStringFromStream(bindingProcessor.getFormData("appletWidth"), charset); - String height = getStringFromStream(bindingProcessor.getFormData("appletHeight"), charset); - String background = getStringFromStream(bindingProcessor.getFormData("appletBackground"), charset); - String guiStyle = getStringFromStream(bindingProcessor.getFormData("appletGuiStyle"), charset); - String hashDataDisplay = getStringFromStream(bindingProcessor.getFormData("appletHashDataDisplay"), charset); - String localeFormParam = getStringFromStream(bindingProcessor.getFormData("locale"), charset); + String width = getStringFromStream(bindingProcessor + .getFormData("appletWidth"), charset); + String height = getStringFromStream(bindingProcessor + .getFormData("appletHeight"), charset); + String background = getStringFromStream(bindingProcessor + .getFormData("appletBackground"), charset); + String guiStyle = getStringFromStream(bindingProcessor + .getFormData("appletGuiStyle"), charset); + String hashDataDisplay = getStringFromStream(bindingProcessor + .getFormData("appletHashDataDisplay"), charset); + String localeFormParam = getStringFromStream(bindingProcessor + .getFormData("locale"), charset); if (width != null) { try { log.trace("Found applet width parameter: " + width); @@ -148,7 +162,8 @@ public class BKURequestHandler extends SpringBKUServlet { session.setAttribute("appletHashDataDisplay", hashDataDisplay); } if (localeFormParam != null) { - log.debug("overrule accept-language locale " + locale + " with form param " + localeFormParam); + log.debug("overrule accept-language locale " + locale + + " with form param " + localeFormParam); locale = new Locale(localeFormParam); } if (locale != null) { @@ -156,8 +171,9 @@ public class BKURequestHandler extends SpringBKUServlet { session.setAttribute("locale", locale.toString()); } - //TODO error if no dispatcher found - RequestDispatcher dispatcher = getServletContext().getNamedDispatcher(BKU_APPLET_JSP); + // TODO error if no dispatcher found + RequestDispatcher dispatcher = getServletContext().getNamedDispatcher( + BKU_APPLET_JSP); log.debug("forward to applet"); dispatcher.forward(req, resp); } diff --git a/BKUOnline/src/main/webapp/applet/BKUApplet-1.0.2-SNAPSHOT.jar b/BKUOnline/src/main/webapp/applet/BKUApplet-1.0.2-SNAPSHOT.jar deleted file mode 100644 index 74f00509..00000000 Binary files a/BKUOnline/src/main/webapp/applet/BKUApplet-1.0.2-SNAPSHOT.jar and /dev/null differ diff --git a/BKUOnline/src/main/webapp/appletPage.jsp b/BKUOnline/src/main/webapp/appletPage.jsp index ee5f429c..b73ed2f4 100644 --- a/BKUOnline/src/main/webapp/appletPage.jsp +++ b/BKUOnline/src/main/webapp/appletPage.jsp @@ -47,7 +47,7 @@ var attributes = { codebase :'applet', code :'at.gv.egiz.bku.online.applet.BKUApplet.class', - archive :'BKUApplet-1.0.2-SNAPSHOT.jar, commons-logging-1.1.1.jar, iaik_jce_me4se-3.04.jar', + archive :'BKUApplet.jar, commons-logging-1.1.1.jar, iaik_jce_me4se-3.04.jar', width : <%=width%>, height :<%=height%> }; diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifier.java b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifier.java index ed4b9bda..61d3d7a5 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifier.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/accesscontroller/AuthenticationClassifier.java @@ -65,7 +65,8 @@ public class AuthenticationClassifier { } catch (CertificateParsingException e) { log.error(e); } - if (cert.getExtensionValue("1.2.40.0.10.1.1.1") != null) { + if ((cert.getExtensionValue("1.2.40.0.10.1.1.1") != null) + || (cert.getExtensionValue("1.2.40.0.10.1.1.2") != null)) { return true; } return false; diff --git a/smcc/src/test/java/at/gv/egiz/smcc/SMCCApplication.java b/smcc/src/test/java/at/gv/egiz/smcc/SMCCApplication.java deleted file mode 100644 index 4835865f..00000000 --- a/smcc/src/test/java/at/gv/egiz/smcc/SMCCApplication.java +++ /dev/null @@ -1,49 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.smcc; - -import java.util.Locale; - -import org.junit.Ignore; - -import at.gv.egiz.smcc.util.SMCCHelper; - -@Ignore -public class SMCCApplication { - - /** - * @param args - */ - public static void main(String[] args) { - - SignatureCard sc = null; - SMCCHelper smccHelper = new SMCCHelper(); - while (smccHelper.getResultCode() != SMCCHelper.CARD_FOUND) { - System.out.println("Did not get a signature card ... "+smccHelper.getResultCode()); - smccHelper.update(); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - sc = smccHelper.getSignatureCard(Locale.getDefault()); - System.out.println("Found supported siganture card: "+sc); - } - -} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/STARCOSCardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/STARCOSCardTest.java deleted file mode 100644 index 7f421474..00000000 --- a/smcc/src/test/java/at/gv/egiz/smcc/STARCOSCardTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.smcc; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStream; -import java.io.PrintWriter; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.Locale; - -import javax.smartcardio.CardException; -import javax.smartcardio.CommandAPDU; -import javax.smartcardio.ResponseAPDU; - -import org.junit.Ignore; - -import sun.misc.HexDumpEncoder; - -import at.gv.egiz.smcc.SignatureCard.KeyboxName; -import at.gv.egiz.smcc.util.SMCCHelper; - -@Ignore -public class STARCOSCardTest { - - /** - * @param args - * @throws Exception - */ - public static void main(String[] args) throws Exception { - - SMCCHelper helper = new SMCCHelper(); - while (helper.getResultCode() != SMCCHelper.CARD_FOUND) { - System.out.println("Did not get a signature card ... " + helper.getResultCode()); - helper.update(); - try { - Thread.sleep(1000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - - SignatureCard signatureCard = helper.getSignatureCard(Locale.getDefault()); - - System.out.println("Found '" + signatureCard + "'."); - - try { -// printJavaByteArray( -// signatureCard.getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR), System.out); -// printJavaByteArray( -// signatureCard.getCertificate(KeyboxName.CERITIFIED_KEYPAIR), System.out); -// System.out. println(new String(signatureCard.getInfobox("IdentityLink", new CommandLinePINProvider(), null))); -// byte[] infobox = signatureCard.getInfobox("Status", new CommandLinePINProvider(), null); -// printJavaByteArray(infobox, System.out); - MessageDigest messageDigest = MessageDigest.getInstance("SHA-1"); - byte[] digest = messageDigest.digest("test".getBytes()); - byte[] signature = signatureCard.createSignature(digest, KeyboxName.SECURE_SIGNATURE_KEYPAIR, new CommandLinePINProvider()); - printJavaByteArray(signature, System.out); - } catch (SignatureCardException e) { - e.printStackTrace(); - } - - } - - public static void printJavaByteArray(byte[] bytes, OutputStream os) { - - PrintWriter w = new PrintWriter(os); - - w.write("new byte[] {"); - for (int i = 0; i < bytes.length;) { - if (i % 8 == 0) { - w.write("\n "); - } - w.write("(byte) 0x" + Integer.toHexString(0x0F & (bytes[i] >> 4)) + Integer.toHexString(0x0F & bytes[i])); - if (++i < bytes.length) { - w.write(", "); - } - } - w.write("\n};"); - w.flush(); - } - - private static class CommandLinePINProvider implements PINProvider { - - @Override - public String providePIN(PINSpec spec, int retries) { - - InputStreamReader inputStreamReader = new InputStreamReader(System.in); - BufferedReader in = new BufferedReader(inputStreamReader); - - System.out.print("Enter " + spec.getLocalizedName() + " [" - + spec.getMinLength() + "-" + spec.getMaxLength() + "] (" + retries - + " retries):"); - - try { - return in.readLine(); - } catch (IOException e) { - return null; - } - - } - - } - -} diff --git a/smcc/src/test/java/at/gv/egiz/smcc/SWCardTest.java b/smcc/src/test/java/at/gv/egiz/smcc/SWCardTest.java deleted file mode 100644 index 115edc16..00000000 --- a/smcc/src/test/java/at/gv/egiz/smcc/SWCardTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/* -* Copyright 2008 Federal Chancellery Austria and -* Graz University of Technology -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -package at.gv.egiz.smcc; - -import java.math.BigInteger; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -import org.junit.Ignore; - -import at.gv.egiz.smcc.SignatureCard.KeyboxName; - -@Ignore -public class SWCardTest implements PINProvider { - - SWCard swCard = new SWCard(); - - public static void main(String[] args) throws Exception { - - SWCardTest swCardTest = new SWCardTest(); - swCardTest.test(); - - } - - public void test() throws SignatureCardException, NoSuchAlgorithmException, InterruptedException { - - swCard.getCertificate(KeyboxName.CERITIFIED_KEYPAIR); - swCard.getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR); - - BigInteger t = BigInteger.valueOf(System.currentTimeMillis()); - - MessageDigest messageDigest = MessageDigest.getInstance("SHA-1"); - byte[] hash = messageDigest.digest(t.toByteArray()); - - byte[] signature; - signature = swCard.createSignature(hash, KeyboxName.CERITIFIED_KEYPAIR, this); - System.out.println(SignatureCardFactory.toString(signature)); - - signature = swCard.createSignature(hash, KeyboxName.SECURE_SIGNATURE_KEYPAIR, this); - System.out.println(SignatureCardFactory.toString(signature)); - - byte[] infobox = swCard.getInfobox("IdentityLink", this, null); - System.out.println(SignatureCardFactory.toString(infobox)); - - } - - @Override - public String providePIN(PINSpec spec, int retries) { - return "buerger"; - } - -} -- cgit v1.2.3 From 9676c9eb710bf10ecb4812043fedacd2f6e6278c Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 20 Jan 2009 14:24:43 +0000 Subject: prepare for stal service extension git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@269 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../gv/egiz/bku/online/applet/AppletBKUWorker.java | 67 +++++++++++----------- .../at/gv/egiz/stal/client/STALServiceTest.java | 6 +- 2 files changed, 37 insertions(+), 36 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java index 9fc21df8..3903bf10 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java @@ -35,6 +35,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; import java.util.List; +import javax.xml.bind.JAXBElement; import javax.xml.namespace.QName; /** @@ -47,9 +48,10 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { protected AppletParameterProvider params; protected String sessionId; protected STALPortType stalPort; + private ObjectFactory stalObjFactory = new ObjectFactory(); public AppletBKUWorker(BKUGUIFacade gui, AppletContext ctx, - AppletParameterProvider paramProvider) { + AppletParameterProvider paramProvider) { super(gui); if (ctx == null) { throw new NullPointerException("Applet context not provided"); @@ -77,7 +79,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { actionCommandList.clear(); actionCommandList.add("ok"); gui.showErrorDialog(BKUGUIFacade.ERR_SERVICE_UNREACHABLE, - new Object[] { e.getMessage() }); + new Object[]{e.getMessage()}); try { waitForAction(); } catch (InterruptedException e1) { @@ -89,14 +91,17 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { try { registerSignRequestHandler(); - ObjectFactory of = new ObjectFactory(); - GetNextRequestResponseType nextRequestResp = stalPort.connect(sessionId); do { - List requests = nextRequestResp - .getInfoboxReadRequestOrSignRequestOrQuitRequest(); - List stalRequests = STALTranslator - .translateRequests(requests); + List> requests = nextRequestResp.getInfoboxReadRequestOrSignRequestOrQuitRequest(); + + // (rather use validator) + if (requests.size() == 0) { + log.error("Received empty NextRequestResponse: no STAL requests to handle. (STAL-X requests might not have gotten unmarshalled)"); + throw new Exception("No STAL requests to handle."); + } + + List stalRequests = STALTranslator.translateRequests(requests); if (log.isInfoEnabled()) { StringBuilder sb = new StringBuilder("Received "); @@ -117,13 +122,13 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { String domainId = r.getDomainIdentifier(); if ("IdentityLink".equals(infoboxId) && domainId == null) { if (!InternalSSLSocketFactory.getInstance().isEgovAgency()) { - handle = false; + handle = false; } } } } - List responses; + List> responses; if (handle) { List stalResponses = handleRequest(stalRequests); if (log.isInfoEnabled()) { @@ -137,28 +142,26 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { } responses = STALTranslator.fromSTAL(stalResponses); } else { - responses = new ArrayList(1); - ErrorResponseType err = of.createErrorResponseType(); + log.error("Insufficient rights to execute command InfoboxReadRequest for Infobox IdentityLink, return Error 6002"); + responses = new ArrayList>(1); + ErrorResponseType err = stalObjFactory.createErrorResponseType(); err.setErrorCode(6002); // err.setErrorMessage(); - responses.add(err); + responses.add(stalObjFactory.createGetNextRequestTypeErrorResponse(err)); } if (!finished) { - log.info("Not finished yet (BKUWorker: " + this - + "), sending responses"); - GetNextRequestType nextRequest = of.createGetNextRequestType(); + log.info("Not finished yet (BKUWorker: " + this + "), sending responses"); + GetNextRequestType nextRequest = stalObjFactory.createGetNextRequestType(); nextRequest.setSessionId(sessionId); - nextRequest.getInfoboxReadResponseOrSignResponseOrErrorResponse() - .addAll(responses); + nextRequest.getInfoboxReadResponseOrSignResponseOrErrorResponse().addAll(responses); nextRequestResp = stalPort.getNextRequest(nextRequest); } } while (!finished); log.info("Done " + Thread.currentThread().getName()); } catch (Exception ex) { log.error(ex.getMessage(), ex); - gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] { ex - .getMessage() }); + gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[]{ex.getMessage()}); try { waitForAction(); } catch (InterruptedException e) { @@ -174,20 +177,18 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { protected void sendRedirect() { try { URL redirectURL = params.getURLParameter(BKUApplet.REDIRECT_URL, - sessionId); - String redirectTarget = params - .getAppletParameter(BKUApplet.REDIRECT_TARGET); + sessionId); + String redirectTarget = params.getAppletParameter(BKUApplet.REDIRECT_TARGET); if (redirectTarget == null) { log.info("Done. Redirecting to " + redirectURL + " ..."); ctx.showDocument(redirectURL); } else { - log.info("Done. Redirecting to " + redirectURL + " (target=" - + redirectTarget + ") ..."); + log.info("Done. Redirecting to " + redirectURL + " (target=" + redirectTarget + ") ..."); ctx.showDocument(redirectURL, redirectTarget); } } catch (MalformedURLException ex) { log.warn("Failed to redirect: " + ex.getMessage(), ex); - // gui.showErrorDialog(errorMsg, okListener, actionCommand) + // gui.showErrorDialog(errorMsg, okListener, actionCommand) } } @@ -195,26 +196,24 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { URL wsdlURL = params.getURLParameter(BKUApplet.WSDL_URL); log.debug("STAL WSDL at " + wsdlURL); QName endpointName = new QName(BKUApplet.STAL_WSDL_NS, - BKUApplet.STAL_SERVICE); + BKUApplet.STAL_SERVICE); STALService stal = new STALService(wsdlURL, endpointName); return stal.getSTALPort(); } private void registerSignRequestHandler() throws MalformedURLException { - String hashDataDisplayStyle = params - .getAppletParameter(BKUApplet.HASHDATA_DISPLAY); + String hashDataDisplayStyle = params.getAppletParameter(BKUApplet.HASHDATA_DISPLAY); if (BKUApplet.HASHDATA_DISPLAY_BROWSER.equals(hashDataDisplayStyle)) { URL hashDataURL = params.getURLParameter(BKUApplet.HASHDATA_URL, - sessionId); + sessionId); log.debug("register SignRequestHandler for HashDataURL " + hashDataURL); addRequestHandler(SignRequest.class, new BrowserHashDataDisplay(ctx, - hashDataURL)); + hashDataURL)); } else { // BKUApplet.HASHDATA_DISPLAY_FRAME - log.debug("register SignRequestHandler for STAL port " - + BKUApplet.WSDL_URL); + log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL); AppletHashDataDisplay handler = new AppletHashDataDisplay(stalPort, - sessionId); + sessionId); addRequestHandler(SignRequest.class, handler); } } diff --git a/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java b/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java index 63da8225..74017c22 100644 --- a/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java +++ b/BKUApplet/src/test/java/at/gv/egiz/stal/client/STALServiceTest.java @@ -41,6 +41,7 @@ import at.gv.egiz.stal.service.types.GetNextRequestResponseType; import at.gv.egiz.stal.service.types.GetNextRequestType; import at.gv.egiz.stal.service.types.InfoboxReadRequestType; import at.gv.egiz.stal.service.types.RequestType; +import javax.xml.bind.JAXBElement; /** * @@ -51,7 +52,7 @@ public class STALServiceTest { // @Test public void callSTAL() { try { - URL endpointURL = new URL("http://localhost:8080/bkuonline/stal?wsdl"); + URL endpointURL = new URL("http://localhost:3495/bkuonline/stal?wsdl"); QName endpointName = new QName("http://www.egiz.gv.at/wsdl/stal", "STALService"); STALService stal = new STALService(endpointURL, endpointName); // stal = new STALService(); @@ -63,7 +64,8 @@ public class STALServiceTest { GetNextRequestResponseType nrResp = port.getNextRequest(nrReq); assertNotNull(nrResp); System.out.println("got response: " + nrResp.getInfoboxReadRequestOrSignRequestOrQuitRequest().size()); - for (RequestType stalReq : nrResp.getInfoboxReadRequestOrSignRequestOrQuitRequest()) { + for (JAXBElement stalReqElt : nrResp.getInfoboxReadRequestOrSignRequestOrQuitRequest()) { + RequestType stalReq = stalReqElt.getValue(); if (stalReq instanceof InfoboxReadRequestType) { String ibid = ((InfoboxReadRequestType) stalReq).getInfoboxIdentifier(); String did = ((InfoboxReadRequestType) stalReq).getDomainIdentifier(); -- cgit v1.2.3 From 4618f05e6a202ef2d502c78a4bd0dc13b9c0aea2 Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 20 Jan 2009 16:38:30 +0000 Subject: [maven-release-plugin] prepare release bku-1.0.2 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@273 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/pom.xml | 14 +++++++------- BKUCommonGUI/pom.xml | 8 ++++---- BKULocal/pom.xml | 22 +++++++++++----------- BKULocalApp/pom.xml | 8 ++++---- BKUOnline/pom.xml | 20 ++++++++++---------- BKUViewer/pom.xml | 6 +++--- STAL/pom.xml | 4 ++-- STALExt/pom.xml | 8 ++++---- STALService/pom.xml | 6 +++--- bkucommon/pom.xml | 8 ++++---- pom.xml | 23 +++++++++-------------- smcc/pom.xml | 4 ++-- smccSTAL/pom.xml | 10 +++++----- utils/pom.xml | 4 ++-- 14 files changed, 70 insertions(+), 75 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml index 8947daa0..49159c5e 100644 --- a/BKUApplet/pom.xml +++ b/BKUApplet/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz BKUApplet BKU Applet - 1.0.2-SNAPSHOT + 1.0.2 @@ -117,27 +117,27 @@ at.gv.egiz smcc - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz STAL - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz STALService - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz smccSTAL - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz BKUCommonGUI - 1.0.2-SNAPSHOT + 1.0.2 commons-logging diff --git a/BKUCommonGUI/pom.xml b/BKUCommonGUI/pom.xml index ff993fa2..64b93904 100644 --- a/BKUCommonGUI/pom.xml +++ b/BKUCommonGUI/pom.xml @@ -2,23 +2,23 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz BKUCommonGUI BKU Common GUI - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz smcc - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz STAL - 1.0.2-SNAPSHOT + 1.0.2 compile diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index 6b3b7fc8..d49ef4d7 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -2,19 +2,19 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz BKULocal war BKU Local - 1.0.2-SNAPSHOT + 1.0.1 - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/bku-1.0.2/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/bku-1.0.2/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/bku-1.0.2/BKULocal @@ -56,22 +56,22 @@ at.gv.egiz STAL - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz bkucommon - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz smcc - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz smccSTAL - 1.0.2-SNAPSHOT + 1.0.2 org.springframework @@ -96,12 +96,12 @@ at.gv.egiz BKUApplet - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz BKUViewer - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/BKULocalApp/pom.xml b/BKULocalApp/pom.xml index f2280e29..e253ab46 100644 --- a/BKULocalApp/pom.xml +++ b/BKULocalApp/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz.bku BKULocalApp BKU Local App - 1.0.2-SNAPSHOT + 1.0.1 @@ -76,13 +76,13 @@ at.gv.egiz BKULocal - 1.0.2-SNAPSHOT + 1.0.1 war utils at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 compile diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index e5db2e55..85209fa9 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -3,14 +3,14 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz BKUOnline war BKU Online - 1.0.2-SNAPSHOT + 1.0.2 @@ -24,12 +24,12 @@ at.gv.egiz bkucommon - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz BKUViewer - 1.0.2-SNAPSHOT + 1.0.2 commons-logging @@ -53,20 +53,20 @@ at.gv.egiz STALService - 1.0.2-SNAPSHOT + 1.0.2 compile at.gv.egiz BKUApplet - 1.0.2-SNAPSHOT + 1.0.2 provided at.gv.egiz STALService - 1.0.2-SNAPSHOT + 1.0.2 + 1.6 1.6 1.6 true @@ -86,8 +84,7 @@ + jaxws-maven-plugin org.codehaus.mojo @@ -109,8 +106,7 @@ + ${basedir}/src/main/assemblies/assembly-server.xml + diff --git a/smcc/pom.xml b/smcc/pom.xml index 62c60e75..a973c809 100644 --- a/smcc/pom.xml +++ b/smcc/pom.xml @@ -2,14 +2,14 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz smcc smcc jar - 1.0.2-SNAPSHOT + 1.0.2 http://bku.egiz.gv.at diff --git a/smccSTAL/pom.xml b/smccSTAL/pom.xml index 3fa65d19..7d4334bd 100644 --- a/smccSTAL/pom.xml +++ b/smccSTAL/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz smccSTAL smcc STAL - 1.0.2-SNAPSHOT + 1.0.2 @@ -24,17 +24,17 @@ at.gv.egiz STAL - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz smcc - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz BKUCommonGUI - 1.0.2-SNAPSHOT + 1.0.2 iaik diff --git a/utils/pom.xml b/utils/pom.xml index b183ea03..52fa6917 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -2,14 +2,14 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz utils BKU Utils jar - 1.0.2-SNAPSHOT + 1.0.2 http://bku.egiz.gv.at -- cgit v1.2.3 From ce598ba5142ff7673085dd90865f9323d69574be Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 20 Jan 2009 16:56:08 +0000 Subject: [maven-release-plugin] rollback the release of bku-1.0.2 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@274 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/pom.xml | 14 +++++++------- BKUCommonGUI/pom.xml | 8 ++++---- BKULocal/pom.xml | 22 +++++++++++----------- BKULocalApp/pom.xml | 8 ++++---- BKUOnline/pom.xml | 20 ++++++++++---------- BKUViewer/pom.xml | 6 +++--- STAL/pom.xml | 4 ++-- STALExt/pom.xml | 8 ++++---- STALService/pom.xml | 6 +++--- bkucommon/pom.xml | 8 ++++---- pom.xml | 23 ++++++++++++++--------- smcc/pom.xml | 4 ++-- smccSTAL/pom.xml | 10 +++++----- utils/pom.xml | 4 ++-- 14 files changed, 75 insertions(+), 70 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml index 49159c5e..8947daa0 100644 --- a/BKUApplet/pom.xml +++ b/BKUApplet/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.2 + 1.0.2-SNAPSHOT 4.0.0 at.gv.egiz BKUApplet BKU Applet - 1.0.2 + 1.0.2-SNAPSHOT @@ -117,27 +117,27 @@ at.gv.egiz smcc - 1.0.2 + 1.0.2-SNAPSHOT at.gv.egiz STAL - 1.0.2 + 1.0.2-SNAPSHOT at.gv.egiz STALService - 1.0.2 + 1.0.2-SNAPSHOT at.gv.egiz smccSTAL - 1.0.2 + 1.0.2-SNAPSHOT at.gv.egiz BKUCommonGUI - 1.0.2 + 1.0.2-SNAPSHOT commons-logging diff --git a/BKUCommonGUI/pom.xml b/BKUCommonGUI/pom.xml index 64b93904..ff993fa2 100644 --- a/BKUCommonGUI/pom.xml +++ b/BKUCommonGUI/pom.xml @@ -2,23 +2,23 @@ bku at.gv.egiz - 1.0.2 + 1.0.2-SNAPSHOT 4.0.0 at.gv.egiz BKUCommonGUI BKU Common GUI - 1.0.2 + 1.0.2-SNAPSHOT at.gv.egiz smcc - 1.0.2 + 1.0.2-SNAPSHOT at.gv.egiz STAL - 1.0.2 + 1.0.2-SNAPSHOT compile diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index d49ef4d7..6b3b7fc8 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -2,19 +2,19 @@ bku at.gv.egiz - 1.0.2 + 1.0.2-SNAPSHOT 4.0.0 at.gv.egiz BKULocal war BKU Local - 1.0.1 + 1.0.2-SNAPSHOT - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/bku-1.0.2/BKULocal - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/bku-1.0.2/BKULocal - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/bku-1.0.2/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal @@ -56,22 +56,22 @@ at.gv.egiz STAL - 1.0.2 + 1.0.2-SNAPSHOT at.gv.egiz bkucommon - 1.0.2 + 1.0.2-SNAPSHOT at.gv.egiz smcc - 1.0.2 + 1.0.2-SNAPSHOT at.gv.egiz smccSTAL - 1.0.2 + 1.0.2-SNAPSHOT org.springframework @@ -96,12 +96,12 @@ at.gv.egiz BKUApplet - 1.0.2 + 1.0.2-SNAPSHOT at.gv.egiz BKUViewer - 1.0.2 + 1.0.2-SNAPSHOT diff --git a/BKULocalApp/pom.xml b/BKULocalApp/pom.xml index e253ab46..f2280e29 100644 --- a/BKULocalApp/pom.xml +++ b/BKULocalApp/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.2 + 1.0.2-SNAPSHOT 4.0.0 at.gv.egiz.bku BKULocalApp BKU Local App - 1.0.1 + 1.0.2-SNAPSHOT @@ -76,13 +76,13 @@ at.gv.egiz BKULocal - 1.0.1 + 1.0.2-SNAPSHOT war utils at.gv.egiz - 1.0.2 + 1.0.2-SNAPSHOT compile diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index 85209fa9..e5db2e55 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -3,14 +3,14 @@ bku at.gv.egiz - 1.0.2 + 1.0.2-SNAPSHOT 4.0.0 at.gv.egiz BKUOnline war BKU Online - 1.0.2 + 1.0.2-SNAPSHOT @@ -24,12 +24,12 @@ at.gv.egiz bkucommon - 1.0.2 + 1.0.2-SNAPSHOT at.gv.egiz BKUViewer - 1.0.2 + 1.0.2-SNAPSHOT commons-logging @@ -53,20 +53,20 @@ at.gv.egiz STALService - 1.0.2 + 1.0.2-SNAPSHOT compile at.gv.egiz BKUApplet - 1.0.2 + 1.0.2-SNAPSHOT provided at.gv.egiz STALService - 1.0.2 + 1.0.2-SNAPSHOT + 1.6 1.6 1.6 true @@ -84,7 +86,8 @@ + jaxws-maven-plugin org.codehaus.mojo @@ -106,7 +109,8 @@ + ${basedir}/src/main/assemblies/assembly-server.xml + diff --git a/smcc/pom.xml b/smcc/pom.xml index a973c809..62c60e75 100644 --- a/smcc/pom.xml +++ b/smcc/pom.xml @@ -2,14 +2,14 @@ bku at.gv.egiz - 1.0.2 + 1.0.2-SNAPSHOT 4.0.0 at.gv.egiz smcc smcc jar - 1.0.2 + 1.0.2-SNAPSHOT http://bku.egiz.gv.at diff --git a/smccSTAL/pom.xml b/smccSTAL/pom.xml index 7d4334bd..3fa65d19 100644 --- a/smccSTAL/pom.xml +++ b/smccSTAL/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.2 + 1.0.2-SNAPSHOT 4.0.0 at.gv.egiz smccSTAL smcc STAL - 1.0.2 + 1.0.2-SNAPSHOT @@ -24,17 +24,17 @@ at.gv.egiz STAL - 1.0.2 + 1.0.2-SNAPSHOT at.gv.egiz smcc - 1.0.2 + 1.0.2-SNAPSHOT at.gv.egiz BKUCommonGUI - 1.0.2 + 1.0.2-SNAPSHOT iaik diff --git a/utils/pom.xml b/utils/pom.xml index 52fa6917..b183ea03 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -2,14 +2,14 @@ bku at.gv.egiz - 1.0.2 + 1.0.2-SNAPSHOT 4.0.0 at.gv.egiz utils BKU Utils jar - 1.0.2 + 1.0.2-SNAPSHOT http://bku.egiz.gv.at -- cgit v1.2.3 From 3f673f19aa8c4aec3d40d98731de289cbb7e79c6 Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 20 Jan 2009 17:01:02 +0000 Subject: [maven-release-plugin] prepare release mocca-1.0.2 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@275 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/pom.xml | 14 +++++++------- BKUCommonGUI/pom.xml | 8 ++++---- BKULocal/pom.xml | 22 +++++++++++----------- BKULocalApp/pom.xml | 8 ++++---- BKUOnline/pom.xml | 20 ++++++++++---------- BKUViewer/pom.xml | 6 +++--- STAL/pom.xml | 4 ++-- STALExt/pom.xml | 8 ++++---- STALService/pom.xml | 6 +++--- bkucommon/pom.xml | 8 ++++---- pom.xml | 23 +++++++++-------------- smcc/pom.xml | 4 ++-- smccSTAL/pom.xml | 10 +++++----- utils/pom.xml | 4 ++-- 14 files changed, 70 insertions(+), 75 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml index 8947daa0..49159c5e 100644 --- a/BKUApplet/pom.xml +++ b/BKUApplet/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz BKUApplet BKU Applet - 1.0.2-SNAPSHOT + 1.0.2 @@ -117,27 +117,27 @@ at.gv.egiz smcc - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz STAL - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz STALService - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz smccSTAL - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz BKUCommonGUI - 1.0.2-SNAPSHOT + 1.0.2 commons-logging diff --git a/BKUCommonGUI/pom.xml b/BKUCommonGUI/pom.xml index ff993fa2..64b93904 100644 --- a/BKUCommonGUI/pom.xml +++ b/BKUCommonGUI/pom.xml @@ -2,23 +2,23 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz BKUCommonGUI BKU Common GUI - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz smcc - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz STAL - 1.0.2-SNAPSHOT + 1.0.2 compile diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index 6b3b7fc8..e147a6ad 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -2,19 +2,19 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz BKULocal war BKU Local - 1.0.2-SNAPSHOT + 1.0.1 - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.2/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.2/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.2/BKULocal @@ -56,22 +56,22 @@ at.gv.egiz STAL - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz bkucommon - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz smcc - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz smccSTAL - 1.0.2-SNAPSHOT + 1.0.2 org.springframework @@ -96,12 +96,12 @@ at.gv.egiz BKUApplet - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz BKUViewer - 1.0.2-SNAPSHOT + 1.0.2 diff --git a/BKULocalApp/pom.xml b/BKULocalApp/pom.xml index f2280e29..e253ab46 100644 --- a/BKULocalApp/pom.xml +++ b/BKULocalApp/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz.bku BKULocalApp BKU Local App - 1.0.2-SNAPSHOT + 1.0.1 @@ -76,13 +76,13 @@ at.gv.egiz BKULocal - 1.0.2-SNAPSHOT + 1.0.1 war utils at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 compile diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index e5db2e55..cfc5507e 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -3,14 +3,14 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz BKUOnline war BKU Online - 1.0.2-SNAPSHOT + 1.0.2 @@ -24,12 +24,12 @@ at.gv.egiz bkucommon - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz BKUViewer - 1.0.2-SNAPSHOT + 1.0.2 commons-logging @@ -53,20 +53,20 @@ at.gv.egiz STALService - 1.0.2-SNAPSHOT + 1.0.2 compile at.gv.egiz BKUApplet - 1.0.2-SNAPSHOT + 1.0.2 provided at.gv.egiz STALService - 1.0.2-SNAPSHOT + 1.0.2 + 1.6 1.6 1.6 true @@ -86,8 +84,7 @@ + jaxws-maven-plugin org.codehaus.mojo @@ -109,8 +106,7 @@ + ${basedir}/src/main/assemblies/assembly-server.xml + diff --git a/smcc/pom.xml b/smcc/pom.xml index 62c60e75..a973c809 100644 --- a/smcc/pom.xml +++ b/smcc/pom.xml @@ -2,14 +2,14 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz smcc smcc jar - 1.0.2-SNAPSHOT + 1.0.2 http://bku.egiz.gv.at diff --git a/smccSTAL/pom.xml b/smccSTAL/pom.xml index 3fa65d19..7d4334bd 100644 --- a/smccSTAL/pom.xml +++ b/smccSTAL/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz smccSTAL smcc STAL - 1.0.2-SNAPSHOT + 1.0.2 @@ -24,17 +24,17 @@ at.gv.egiz STAL - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz smcc - 1.0.2-SNAPSHOT + 1.0.2 at.gv.egiz BKUCommonGUI - 1.0.2-SNAPSHOT + 1.0.2 iaik diff --git a/utils/pom.xml b/utils/pom.xml index b183ea03..52fa6917 100644 --- a/utils/pom.xml +++ b/utils/pom.xml @@ -2,14 +2,14 @@ bku at.gv.egiz - 1.0.2-SNAPSHOT + 1.0.2 4.0.0 at.gv.egiz utils BKU Utils jar - 1.0.2-SNAPSHOT + 1.0.2 http://bku.egiz.gv.at -- cgit v1.2.3 From ce977ee25ede5535beaf72bd0555c0984d5741bf Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 20 Jan 2009 17:01:18 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@277 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/pom.xml | 14 +++++++------- BKUCommonGUI/pom.xml | 8 ++++---- BKULocal/pom.xml | 22 +++++++++++----------- BKULocalApp/pom.xml | 8 ++++---- BKUOnline/pom.xml | 20 ++++++++++---------- BKUViewer/pom.xml | 6 +++--- STAL/pom.xml | 4 ++-- STALExt/pom.xml | 6 +++--- STALService/pom.xml | 6 +++--- bkucommon/pom.xml | 8 ++++---- pom.xml | 8 ++++---- smcc/pom.xml | 4 ++-- smccSTAL/pom.xml | 10 +++++----- utils/pom.xml | 4 ++-- 14 files changed, 64 insertions(+), 64 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml index 49159c5e..303a44ff 100644 --- a/BKUApplet/pom.xml +++ b/BKUApplet/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.2 + 1.0.3-SNAPSHOT 4.0.0 at.gv.egiz BKUApplet BKU Applet - 1.0.2 + 1.0.3-SNAPSHOT @@ -117,27 +117,27 @@ at.gv.egiz smcc - 1.0.2 + 1.0.3-SNAPSHOT at.gv.egiz STAL - 1.0.2 + 1.0.3-SNAPSHOT at.gv.egiz STALService - 1.0.2 + 1.0.3-SNAPSHOT at.gv.egiz smccSTAL - 1.0.2 + 1.0.3-SNAPSHOT at.gv.egiz BKUCommonGUI - 1.0.2 + 1.0.3-SNAPSHOT commons-logging diff --git a/BKUCommonGUI/pom.xml b/BKUCommonGUI/pom.xml index 64b93904..fc99b6bb 100644 --- a/BKUCommonGUI/pom.xml +++ b/BKUCommonGUI/pom.xml @@ -2,23 +2,23 @@ bku at.gv.egiz - 1.0.2 + 1.0.3-SNAPSHOT 4.0.0 at.gv.egiz BKUCommonGUI BKU Common GUI - 1.0.2 + 1.0.3-SNAPSHOT at.gv.egiz smcc - 1.0.2 + 1.0.3-SNAPSHOT at.gv.egiz STAL - 1.0.2 + 1.0.3-SNAPSHOT compile diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index e147a6ad..ab1b9fb9 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -2,19 +2,19 @@ bku at.gv.egiz - 1.0.2 + 1.0.3-SNAPSHOT 4.0.0 at.gv.egiz BKULocal war BKU Local - 1.0.1 + 1.0.3-SNAPSHOT - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.2/BKULocal - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.2/BKULocal - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.2/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal @@ -56,22 +56,22 @@ at.gv.egiz STAL - 1.0.2 + 1.0.3-SNAPSHOT at.gv.egiz bkucommon - 1.0.2 + 1.0.3-SNAPSHOT at.gv.egiz smcc - 1.0.2 + 1.0.3-SNAPSHOT at.gv.egiz smccSTAL - 1.0.2 + 1.0.3-SNAPSHOT org.springframework @@ -96,12 +96,12 @@ at.gv.egiz BKUApplet - 1.0.2 + 1.0.3-SNAPSHOT at.gv.egiz BKUViewer - 1.0.2 + 1.0.3-SNAPSHOT diff --git a/BKULocalApp/pom.xml b/BKULocalApp/pom.xml index e253ab46..10035ee5 100644 --- a/BKULocalApp/pom.xml +++ b/BKULocalApp/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.2 + 1.0.3-SNAPSHOT 4.0.0 at.gv.egiz.bku BKULocalApp BKU Local App - 1.0.1 + 1.0.3-SNAPSHOT @@ -76,13 +76,13 @@ at.gv.egiz BKULocal - 1.0.1 + 1.0.3-SNAPSHOT war utils at.gv.egiz - 1.0.2 + 1.0.3-SNAPSHOT compile diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index cfc5507e..d705ee3d 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -3,14 +3,14 @@ bku at.gv.egiz - 1.0.2 + 1.0.3-SNAPSHOT 4.0.0 at.gv.egiz BKUOnline war BKU Online - 1.0.2 + 1.0.3-SNAPSHOT @@ -24,12 +24,12 @@ at.gv.egiz bkucommon - 1.0.2 + 1.0.3-SNAPSHOT at.gv.egiz BKUViewer - 1.0.2 + 1.0.3-SNAPSHOT commons-logging @@ -53,20 +53,20 @@ at.gv.egiz STALService - 1.0.2 + 1.0.3-SNAPSHOT compile at.gv.egiz BKUApplet - 1.0.2 + 1.0.3-SNAPSHOT provided at.gv.egiz STALService - 1.0.2 + 1.0.3-SNAPSHOT at.gv.egiz BKUApplet - 1.0.3-SNAPSHOT + 1.0.3 provided at.gv.egiz STALService - 1.0.3-SNAPSHOT + 1.0.3 at.gv.egiz BKUApplet - 1.0.3 + 1.0.4-SNAPSHOT provided at.gv.egiz STALService - 1.0.3 + 1.0.4-SNAPSHOT - - + + - - diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index 5ee0058f..51906616 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -63,9 +63,11 @@ public interface BKUGUIFacade { public static final String MESSAGE_INSERTCARD = "message.insertcard"; public static final String MESSAGE_ENTERPIN = "message.enterpin"; public static final String MESSAGE_HASHDATALINK = "message.hashdatalink"; + public static final String MESSAGE_HASHDATALINK_TINY = "message.hashdatalink.tiny"; // public static final String MESSAGE_HASHDATA = "message.hashdata"; public static final String MESSAGE_HASHDATALIST = "message.hashdatalist"; public static final String MESSAGE_RETRIES = "message.retries"; + public static final String MESSAGE_LAST_RETRY = "message.retries.last"; public static final String MESSAGE_OVERWRITE = "message.overwrite"; public static final String MESSAGE_HELP = "message.help"; public static final String WARNING_XHTML = "warning.xhtml"; @@ -90,7 +92,7 @@ public interface BKUGUIFacade { public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix"; public static final String ALT_HELP = "alt.help"; - public enum Style { simple, advanced }; + public enum Style { tiny, simple, advanced }; // public void init(Container contentPane, Locale locale, Style guiStyle, URL background, ActionListener helpListener); 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 d61c9a03..1e63c8d7 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 @@ -53,6 +53,7 @@ import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JScrollPane; import javax.swing.JTable; +import javax.swing.JTextField; import javax.swing.LayoutStyle; import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; @@ -69,6 +70,10 @@ public class BKUGUIImpl implements BKUGUIFacade { private static final Log log = LogFactory.getLog(BKUGUIImpl.class); + protected enum PinLabelPosition { + LEFT, ABOVE + } + protected HelpMouseListener helpListener; protected Container contentPane; @@ -92,6 +97,9 @@ public class BKUGUIImpl implements BKUGUIFacade { protected boolean renderHeaderPanel = false; protected boolean renderIconPanel = false; protected boolean renderCancelButton = false; + protected boolean shortText = false; + protected PinLabelPosition pinLabelPos = PinLabelPosition.LEFT; + protected boolean renderRefId = false; /** * set contentPane @@ -125,6 +133,10 @@ public class BKUGUIImpl implements BKUGUIFacade { renderHeaderPanel = true; renderIconPanel = false; renderCancelButton = true; + renderRefId = true; + } else if (guiStyle == Style.tiny) { + shortText = true; + pinLabelPos = PinLabelPosition.ABOVE; } registerHelpListener(helpListener); @@ -537,11 +549,21 @@ public class BKUGUIImpl implements BKUGUIFacade { if (numRetries < 0) { infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); String infoPattern = messages.getString(MESSAGE_ENTERPIN); - infoLabel.setText(MessageFormat.format(infoPattern, new Object[] {pinSpec.getLocalizedName()})); + if (shortText) { + infoLabel.setText(MessageFormat.format(infoPattern, new Object[] {"PIN"})); + } else { + infoLabel.setText(MessageFormat.format(infoPattern, new Object[] {pinSpec.getLocalizedName()})); + } helpListener.setHelpTopic(HELP_CARDPIN); } else { + String retryPattern; + if (numRetries < 2) { + retryPattern = messages.getString(MESSAGE_LAST_RETRY); + } else { + retryPattern = messages.getString(MESSAGE_RETRIES); + } infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD)); - infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); + infoLabel.setText(MessageFormat.format(retryPattern, new Object[]{String.valueOf(numRetries)})); infoLabel.setForeground(ERROR_COLOR); helpListener.setHelpTopic(HELP_RETRY); } @@ -570,27 +592,47 @@ public class BKUGUIImpl implements BKUGUIFacade { infoVertical .addComponent(helpLabel); } - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(infoHorizontal) + + GroupLayout.Group pinHorizontal; + GroupLayout.Group pinVertical; + + if (pinLabelPos == PinLabelPosition.ABOVE) { + pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //)) - .addComponent(pinsizeLabel)))); - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(infoVertical) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); + pinVertical = mainPanelLayout.createSequentialGroup() + .addComponent(cardPinLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(cardPinLabel) - .addComponent(pinField)) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); + } else { + pinHorizontal = mainPanelLayout.createSequentialGroup() + .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinsizeLabel)); - - + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pinsizeLabel)); + pinVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(cardPinLabel) + .addComponent(pinField); + } + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(infoHorizontal) + .addGroup(pinHorizontal)); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addGroup(infoVertical) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(pinVertical) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel)); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); buttonPanel.setLayout(buttonPanelLayout); @@ -707,7 +749,11 @@ public class BKUGUIImpl implements BKUGUIFacade { JLabel infoLabel = new JLabel(); if (numRetries < 0) { infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - infoLabel.setText(messages.getString(MESSAGE_HASHDATALINK)); + if (shortText) { + infoLabel.setText(messages.getString(MESSAGE_HASHDATALINK_TINY)); + } else { + infoLabel.setText(messages.getString(MESSAGE_HASHDATALINK)); + } infoLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); infoLabel.setForeground(HYPERLINK_COLOR); infoLabel.addMouseListener(new MouseAdapter() { @@ -720,8 +766,14 @@ public class BKUGUIImpl implements BKUGUIFacade { }); helpListener.setHelpTopic(HELP_SIGNPIN); } else { + String retryPattern; + if (numRetries < 2) { + retryPattern = messages.getString(MESSAGE_LAST_RETRY); + } else { + retryPattern = messages.getString(MESSAGE_RETRIES); + } + infoLabel.setText(MessageFormat.format(retryPattern, new Object[]{String.valueOf(numRetries)})); infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD)); - infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)})); infoLabel.setForeground(ERROR_COLOR); helpListener.setHelpTopic(HELP_RETRY); } @@ -737,28 +789,48 @@ public class BKUGUIImpl implements BKUGUIFacade { if (!renderHeaderPanel) { infoHorizontal .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel); //, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); + .addComponent(helpLabel); infoVertical .addComponent(helpLabel); } + GroupLayout.Group pinHorizontal; + GroupLayout.Group pinVertical; + + if (pinLabelPos == PinLabelPosition.ABOVE) { + pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(mainPanelLayout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); + + pinVertical = mainPanelLayout.createSequentialGroup() + .addComponent(signPinLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); + } else { + pinHorizontal = mainPanelLayout.createSequentialGroup() + .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pinsizeLabel)); + pinVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(signPinLabel) + .addComponent(pinField); + } + mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup(infoHorizontal) - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pinsizeLabel)))); + .addGroup(pinHorizontal)); mainPanelLayout.setVerticalGroup( mainPanelLayout.createSequentialGroup() .addGroup(infoVertical) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(signPinLabel) - .addComponent(pinField)) + .addGroup(pinVertical) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(pinsizeLabel)); @@ -1084,9 +1156,9 @@ public class BKUGUIImpl implements BKUGUIFacade { String refIdLabelPattern = messages.getString(MESSAGE_HASHDATALIST); refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.size()})); - HashDataTableModel tableModel = new HashDataTableModel(signedReferences); + HashDataTableModel tableModel = new HashDataTableModel(signedReferences, renderRefId); final JTable hashDataTable = new JTable(tableModel); - hashDataTable.setDefaultRenderer(HashDataInput.class, new HyperlinkRenderer()); + hashDataTable.setDefaultRenderer(HashDataInput.class, new HyperlinkRenderer(renderRefId)); hashDataTable.setTableHeader(null); // not possible to add mouse listener to TableCellRenderer diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java index b0f51a78..70842102 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java @@ -31,14 +31,23 @@ class HashDataTableModel extends DefaultTableModel { protected static final Log log = LogFactory.getLog(HashDataTableModel.class); /** HashDataInput in first column, register hyperlinkrenderer only here */ - protected Class[] types = new Class[]{ HashDataInput.class, String.class }; + protected Class[] types; protected List hashDataInputs; - - public HashDataTableModel(List hashDataInputs) { - super(0, 2); + + public HashDataTableModel(List hashDataInputs, boolean twoColLayout) { + super(0, (twoColLayout) ? 2 : 1); this.hashDataInputs = hashDataInputs; - for (HashDataInput hdi : hashDataInputs) { - addRow(new Object[]{ hdi, hdi.getMimeType()}); + + if (twoColLayout) { + types = new Class[] { HashDataInput.class, String.class }; + for (HashDataInput hdi : hashDataInputs) { + addRow(new Object[] { hdi, hdi.getMimeType() }); + } + } else { + types = new Class[] { HashDataInput.class }; + for (HashDataInput hdi : hashDataInputs) { + addRow(new Object[] { hdi }); + } } } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java index f983706e..16024fcc 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java @@ -26,13 +26,25 @@ import javax.swing.table.DefaultTableCellRenderer; */ public class HyperlinkRenderer extends DefaultTableCellRenderer { + protected boolean renderReferenceId; + + public HyperlinkRenderer(boolean renderReferenceId) { + this.renderReferenceId = renderReferenceId; + } + /** * cannot change mouse cursor here, do in jTable * @param value */ @Override protected void setValue(Object value) { - super.setText("" + ((HashDataInput) value).getReferenceId() + ""); + String hrefText; + if (renderReferenceId) { + hrefText = ((HashDataInput) value).getReferenceId(); + } else { + hrefText = ((HashDataInput) value).getMimeType(); + } + super.setText("" + hrefText + ""); setForeground(BKUGUIFacade.HYPERLINK_COLOR); } } diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index d2b47a9d..4562fda5 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -32,11 +32,13 @@ message.wait=Bitte warten... message.insertcard=Bitte die B\u00FCrgerkarte in den Kartenleser stecken message.enterpin={0} eingeben message.hashdatalink=Signaturdaten anzeigen +message.hashdatalink.tiny=Signaturdaten #message.hashdata=Hinweis: Dies ist eine Voransicht des zu signierenden Inhalts. F\u00FCr eine standardkonforme Darstellung siehe Hilfe (i). #message.hashdata=Dies ist eine Voransicht des zu signierenden Inhaltes. F\u00FCr Details siehe Hilfe (i). #verwenden sie bitte die von ihrem System zur Verf\u00FCgung gestellte {0} Anwendung. message.hashdatalist={0} Signaturdaten: -message.retries=Noch {0} Versuch(e) +message.retries.last=Letzter Versuch! +message.retries=Noch {0} Versuche message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben? message.help=Hilfe zu {0} warning.xhtml=Hinweis: Dies ist eine Voransicht des zu signierenden Inhalts. F\u00FCr eine standardkonforme Darstellung siehe Hilfe (i). diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties index 524a2a98..0faa3dba 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties @@ -32,8 +32,10 @@ message.wait=Please wait... message.insertcard=Please insert your citizen card into the reader message.enterpin=Enter {0} message.hashdatalink=Display signature data +message.hashdatalink.tiny=signature data #message.hashdata=Remark: This is a preview of the data to-be signed. For standards compliant display see help. message.hashdatalist={0} signature data objects: +message.retries.last=Last try! message.retries={0} tries left message.overwrite=Overwrite {0}? message.help=Help topic {0} @@ -60,7 +62,8 @@ error.no.hashdata=No signature data available: {0} error.display.hashdata=Could not display signature data: {0} error.write.hashdata=Could not save signature data: {0} error.invalid.hash=Invalid signature data: {0} -error.ws.unreachable=Web-service unreachable: {0} +error.ws.unreachable=Server unreachable +#error.ws.unreachable=Web-service unreachable: {0} error.pcsc=No PC/SC interface for smartcard access provided error.cardterminal=Could not find smartcard reader error.unknown=An error occured: {0} 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 bc4bdb97..d413f812 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 @@ -39,8 +39,8 @@ public class BKUGUITest { public void testBKUGUI() { JFrame testFrame = new JFrame("BKUGUITest"); Container contentPane = testFrame.getContentPane(); - contentPane.setPreferredSize(new Dimension(190, 130)); - BKUGUIFacade gui = BKUGUIFactory.createGUI(contentPane, null, BKUGUIFacade.Style.simple, null, null); + contentPane.setPreferredSize(new Dimension(170, 150)); + BKUGUIFacade gui = BKUGUIFactory.createGUI(contentPane, null, BKUGUIFacade.Style.tiny, null, null); BKUGUIWorker worker = new BKUGUIWorker(); worker.init(gui); testFrame.pack(); diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java index 4d97f9fb..73aaab46 100644 --- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java +++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java @@ -142,17 +142,17 @@ public class BKUGUIWorker implements Runnable { // Thread.sleep(2000); // // PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN"); -// +// // gui.showCardPINDialog(cardPinSpec, okListener, "ok", cancelListener, "cancel"); // // Thread.sleep(2000); // -// gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); + gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); // // Thread.sleep(4000); // - gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, null, null); +// gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, null, null); // gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); // -- cgit v1.2.3 From bd34234d256ef1f81c6daba2de33ed68ccc790f1 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 23 Jan 2009 14:04:04 +0000 Subject: [maven-release-plugin] prepare release mocca-1.0.4-fon git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@287 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUApplet/pom.xml | 14 +++++++------- BKUCommonGUI/pom.xml | 8 ++++---- BKULocal/pom.xml | 22 +++++++++++----------- BKULocalApp/pom.xml | 8 ++++---- BKUOnline/pom.xml | 20 ++++++++++---------- BKUViewer/pom.xml | 6 +++--- STAL/pom.xml | 4 ++-- STALExt/pom.xml | 6 +++--- STALService/pom.xml | 6 +++--- bkucommon/pom.xml | 8 ++++---- pom.xml | 8 ++++---- smcc/pom.xml | 4 ++-- smccSTAL/pom.xml | 10 +++++----- utils/pom.xml | 4 ++-- 14 files changed, 64 insertions(+), 64 deletions(-) (limited to 'BKUApplet') diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml index 4491ff3a..cfae6716 100644 --- a/BKUApplet/pom.xml +++ b/BKUApplet/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.4-SNAPSHOT + 1.0.4 4.0.0 at.gv.egiz BKUApplet BKU Applet - 1.0.4-SNAPSHOT + 1.0.4 @@ -110,27 +110,27 @@ at.gv.egiz smcc - 1.0.4-SNAPSHOT + 1.0.4 at.gv.egiz STAL - 1.0.4-SNAPSHOT + 1.0.4 at.gv.egiz STALService - 1.0.4-SNAPSHOT + 1.0.4 at.gv.egiz smccSTAL - 1.0.4-SNAPSHOT + 1.0.4 at.gv.egiz BKUCommonGUI - 1.0.4-SNAPSHOT + 1.0.4 commons-logging diff --git a/BKUCommonGUI/pom.xml b/BKUCommonGUI/pom.xml index 32d39042..9088a711 100644 --- a/BKUCommonGUI/pom.xml +++ b/BKUCommonGUI/pom.xml @@ -2,23 +2,23 @@ bku at.gv.egiz - 1.0.4-SNAPSHOT + 1.0.4 4.0.0 at.gv.egiz BKUCommonGUI BKU Common GUI - 1.0.4-SNAPSHOT + 1.0.4 at.gv.egiz smcc - 1.0.4-SNAPSHOT + 1.0.4 at.gv.egiz STAL - 1.0.4-SNAPSHOT + 1.0.4 compile diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index 0572fcb2..8b5fe405 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -2,19 +2,19 @@ bku at.gv.egiz - 1.0.4-SNAPSHOT + 1.0.4 4.0.0 at.gv.egiz BKULocal war BKU Local - 1.0.4-SNAPSHOT + 1.0.1 - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.4-fon/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.4-fon/BKULocal + scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/tags/mocca-1.0.4-fon/BKULocal @@ -56,22 +56,22 @@ at.gv.egiz STAL - 1.0.4-SNAPSHOT + 1.0.4 at.gv.egiz bkucommon - 1.0.4-SNAPSHOT + 1.0.4 at.gv.egiz smcc - 1.0.4-SNAPSHOT + 1.0.4 at.gv.egiz smccSTAL - 1.0.4-SNAPSHOT + 1.0.4 org.springframework @@ -96,12 +96,12 @@ at.gv.egiz BKUApplet - 1.0.4-SNAPSHOT + 1.0.4 at.gv.egiz BKUViewer - 1.0.4-SNAPSHOT + 1.0.4 diff --git a/BKULocalApp/pom.xml b/BKULocalApp/pom.xml index ac56c906..0e552bf0 100644 --- a/BKULocalApp/pom.xml +++ b/BKULocalApp/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.0.4-SNAPSHOT + 1.0.4 4.0.0 at.gv.egiz.bku BKULocalApp BKU Local App - 1.0.4-SNAPSHOT + 1.0.1 @@ -76,13 +76,13 @@ at.gv.egiz BKULocal - 1.0.4-SNAPSHOT + 1.0.1 war utils at.gv.egiz - 1.0.4-SNAPSHOT + 1.0.4 compile diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index c5c77546..18c5d122 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -3,14 +3,14 @@ bku at.gv.egiz - 1.0.4-SNAPSHOT + 1.0.4 4.0.0 at.gv.egiz BKUOnline war BKU Online - 1.0.4-SNAPSHOT + 1.0.4 @@ -24,12 +24,12 @@ at.gv.egiz bkucommon - 1.0.4-SNAPSHOT + 1.0.4 at.gv.egiz BKUViewer - 1.0.4-SNAPSHOT + 1.0.4 commons-logging @@ -53,20 +53,20 @@ at.gv.egiz STALService - 1.0.4-SNAPSHOT + 1.0.4 compile at.gv.egiz BKUApplet - 1.0.4-SNAPSHOT + 1.0.4 provided at.gv.egiz STALService - 1.0.4-SNAPSHOT + 1.0.4 at.gv.egiz BKUApplet - 1.0.4 + 1.0.5-SNAPSHOT provided at.gv.egiz STALService - 1.0.4 + 1.0.5-SNAPSHOT + META-INF\/ + + + + + copy_testapplet + + copy-dependencies + + + ${project.build.directory}/test-classes + at.gv.egiz,commons-logging,iaik + commons-logging,iaik_jce_me4se + true + @@ -80,30 +68,6 @@ true
- - maven-dependency-plugin - - - copytestlibs - - copy - - - - - commons-logging - commons-logging - - - iaik - iaik_jce_me4se - - - ${project.build.directory}/test-libs - - - -
@@ -132,9 +96,5 @@ BKUCommonGUI 1.0.5-SNAPSHOT - - commons-logging - commons-logging - \ No newline at end of file diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java index 6ac892ec..388f045f 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java @@ -22,7 +22,6 @@ import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; import at.gv.egiz.stal.service.STALPortType; -import at.gv.egiz.stal.service.STALService; import at.gv.egiz.stal.service.translator.STALTranslator; import at.gv.egiz.stal.service.translator.TranslationException; import at.gv.egiz.stal.service.types.ErrorResponseType; @@ -31,13 +30,10 @@ import at.gv.egiz.stal.service.types.GetNextRequestType; 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 java.applet.AppletContext; import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; import java.util.List; import javax.xml.bind.JAXBElement; -import javax.xml.namespace.QName; import javax.xml.ws.WebServiceException; /** @@ -46,29 +42,19 @@ import javax.xml.ws.WebServiceException; */ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { - protected AppletContext ctx; - protected AppletParameterProvider params; + protected BKUApplet applet; protected String sessionId; - protected STALPortType stalPort; + private ObjectFactory stalObjFactory = new ObjectFactory(); - private STALTranslator translator = new STALTranslator(); - public AppletBKUWorker(BKUGUIFacade gui, AppletContext ctx, - AppletParameterProvider paramProvider) { + public AppletBKUWorker(BKUApplet applet, BKUGUIFacade gui) { super(gui); - if (ctx == null) { - throw new NullPointerException("Applet context not provided"); - } - if (paramProvider == null) { - throw new NullPointerException("No applet parameters provided"); - } - this.ctx = ctx; - this.params = paramProvider; - - sessionId = params.getAppletParameter(BKUApplet.SESSION_ID); + this.applet = applet; + + sessionId = applet.getParameter(BKUApplet.SESSION_ID); if (sessionId == null) { sessionId = "TestSession"; - log.info("using dummy sessionId " + sessionId); + log.warn("using dummy sessionId " + sessionId); } } @@ -77,9 +63,11 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { gui.showWelcomeDialog(); try { - stalPort = getSTALPort(); + STALPortType stalPort = applet.getSTALPort(); + STALTranslator stalTranslator = applet.getSTALTranslator(); - registerSignRequestHandler(stalPort, sessionId); + addRequestHandler(SignRequest.class, + new AppletHashDataDisplay(stalPort, sessionId)); GetNextRequestResponseType nextRequestResp = stalPort.connect(sessionId); @@ -111,7 +99,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { List stalRequests = new ArrayList(); for (JAXBElement req : requests) { try { - stalRequests.add(translator.translate(req)); + stalRequests.add(stalTranslator.translate(req)); } catch (TranslationException ex) { log.error("Received unknown request from server STAL: " + ex.getMessage()); throw new RuntimeException(ex); @@ -123,7 +111,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { List stalResponses = handleRequest(stalRequests); for (STALResponse stalResponse : stalResponses) { try { - responses.add(translator.translate(stalResponse)); + responses.add(stalTranslator.translate(stalResponse)); } catch (TranslationException ex) { log.error("Received unknown response from STAL: " + ex.getMessage()); throw new RuntimeException(ex); @@ -184,7 +172,7 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { } } - sendRedirect(); + applet.sendRedirect(sessionId); } /** @@ -218,38 +206,4 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable { log.error(e); } } - - protected void sendRedirect() { - try { - URL redirectURL = params.getURLParameter(BKUApplet.REDIRECT_URL, - sessionId); - String redirectTarget = params.getAppletParameter(BKUApplet.REDIRECT_TARGET); - if (redirectTarget == null) { - log.info("Done. Redirecting to " + redirectURL + " ..."); - ctx.showDocument(redirectURL); - } else { - log.info("Done. Redirecting to " + redirectURL + " (target=" + redirectTarget + ") ..."); - ctx.showDocument(redirectURL, redirectTarget); - } - } catch (MalformedURLException ex) { - log.warn("Failed to redirect: " + ex.getMessage(), ex); - // gui.showErrorDialog(errorMsg, okListener, actionCommand) - } - } - - private STALPortType getSTALPort() throws MalformedURLException { - URL wsdlURL = params.getURLParameter(BKUApplet.WSDL_URL); - log.debug("STAL WSDL at " + wsdlURL); - QName endpointName = new QName(BKUApplet.STAL_WSDL_NS, - BKUApplet.STAL_SERVICE); - STALService stal = new STALService(wsdlURL, endpointName); - return stal.getSTALPort(); - } - - private void registerSignRequestHandler(STALPortType stalPort, String sessionId) { - log.debug("register SignRequestHandler (resolve hashdata via STAL Webservice)"); - AppletHashDataDisplay handler = new AppletHashDataDisplay(stalPort, - sessionId); - addRequestHandler(SignRequest.class, handler); - } } diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletParameterProvider.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletParameterProvider.java deleted file mode 100644 index 42e2d6ff..00000000 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletParameterProvider.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2008 Federal Chancellery Austria and - * Graz University of Technology - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package at.gv.egiz.bku.online.applet; - -import java.net.MalformedURLException; -import java.net.URL; - -/** - * - * @author Clemens Orthacker - */ -public interface AppletParameterProvider { - - /** - * Applet configuration parameters - * - * @param paramKey - * @return null if no parameter is provided for the given key - */ - String getAppletParameter(String paramKey); - - /** - * Get applet configuration parameter as (absolute) URL - * - * @param paramKey - * @return a URL - * @throws MalformedURLException if configured URL is invalid - * or no parameter is provided for the given key - */ - URL getURLParameter(String paramKey) throws MalformedURLException; - - /** - * Get applet configuration parameter as (absolute) URL - * - * @param paramKey - * @param sessionId adds the jsessionid to the URL - * @return a URL - * @throws MalformedURLException if configured URL is invalid - * or no parameter is provided for the given key - */ - URL getURLParameter(String paramKey, String sessionId) throws MalformedURLException; -} 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 5e60ed3e..d4b2018d 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 @@ -16,8 +16,10 @@ */ package at.gv.egiz.bku.online.applet; +import at.gv.egiz.bku.gui.BKUGUIFacade.Style; import at.gv.egiz.bku.gui.DefaultHelpListener; import at.gv.egiz.bku.gui.AbstractHelpListener; +import at.gv.egiz.stal.service.translator.STALTranslator; import java.net.MalformedURLException; import java.net.URL; import java.util.Locale; @@ -30,15 +32,18 @@ import org.apache.commons.logging.LogFactory; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIFactory; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.STALService; +import java.awt.Container; +import javax.xml.namespace.QName; /** * Note: all swing code is executed by the event dispatch thread (see * BKUGUIFacade) */ -public class BKUApplet extends JApplet implements AppletParameterProvider { +public class BKUApplet extends JApplet { private static Log log = LogFactory.getLog(BKUApplet.class); - /** * Applet parameter keys */ @@ -55,18 +60,15 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { // public static final String HASHDATA_DISPLAY_INTERNAL = "internal"; // public static final String HASHDATA_DISPLAY_BROWSER = "browser"; public static final String HASHDATA_DISPLAY_FRAME = "frame"; - /** * STAL WSDL namespace and service name */ public static final String STAL_WSDL_NS = "http://www.egiz.gv.at/wsdl/stal"; public static final String STAL_SERVICE = "STALService"; - /** * Dummy session id, used if no sessionId parameter is provided */ protected static final String TEST_SESSION_ID = "TestSession"; - /** * STAL */ @@ -81,17 +83,17 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { public void init() { log.info("Welcome to MOCCA"); log.debug("Called init()"); - + HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance()); - String locale = getAppletParameter(LOCALE); + String locale = getParameter(LOCALE); if (locale != null) { this.setLocale(new Locale(locale)); } - log.debug("setting locale to " + getLocale()); + log.debug("setting locale: " + getLocale()); BKUGUIFacade.Style guiStyle; - String guiStyleParam = getAppletParameter(GUI_STYLE); + String guiStyleParam = getParameter(GUI_STYLE); if ("advanced".equals(guiStyleParam)) { guiStyle = BKUGUIFacade.Style.advanced; } else if ("tiny".equals(guiStyleParam)) { @@ -99,30 +101,33 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { } else { guiStyle = BKUGUIFacade.Style.simple; } - + log.debug("setting gui-style: " + guiStyle); + URL backgroundImgURL = null; try { - backgroundImgURL = getURLParameter(BACKGROUND_IMG); + backgroundImgURL = getURLParameter(BACKGROUND_IMG, null); + log.debug("setting background: " + backgroundImgURL); } catch (MalformedURLException ex) { log.warn("failed to load applet background image: " + ex.getMessage() + ", using default"); } - + AbstractHelpListener helpListener = null; try { - URL helpURL = getURLParameter(HELP_URL); -// helpListener = new BrowserHelpListener(getAppletContext(), helpURL, getLocale()); - helpListener = new DefaultHelpListener(getAppletContext(), helpURL, getLocale()); + helpListener = new DefaultHelpListener(getAppletContext(), + getURLParameter(HELP_URL, null), getLocale()); + if (log.isDebugEnabled()) { + log.debug("setting helpURL: " + getURLParameter(HELP_URL, null)); + } } catch (MalformedURLException ex) { log.warn("failed to load help URL: " + ex.getMessage() + ", disabling help"); } - - BKUGUIFacade gui = BKUGUIFactory.createGUI(getContentPane(), - getLocale(), - guiStyle, - backgroundImgURL, + + BKUGUIFacade gui = createGUI(getContentPane(), getLocale(), + guiStyle, + backgroundImgURL, helpListener); - worker = new AppletBKUWorker(gui, getAppletContext(), this); + worker = new AppletBKUWorker(this, gui); } @Override @@ -145,15 +150,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { log.debug("Called destroy()"); } - @Override - public String getAppletParameter(String paramKey) { - String param = getParameter(paramKey); - log.info("applet parameter: " + paramKey + ": " + param); - return param; - } - - @Override - public URL getURLParameter(String paramKey, String sessionId) throws MalformedURLException { + protected URL getURLParameter(String paramKey, String sessionId) throws MalformedURLException { String urlParam = getParameter(paramKey); if (urlParam != null) { URL codebase = getCodeBase(); @@ -173,15 +170,54 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { } catch (MalformedURLException ex) { log.error("applet paremeter " + urlParam + " is not a valid URL: " + ex.getMessage()); throw ex; - } + } } else { log.error("applet paremeter " + urlParam + " not set"); throw new MalformedURLException(urlParam + " not set"); } } - - @Override - public URL getURLParameter(String paramKey) throws MalformedURLException { - return getURLParameter(paramKey, null); + + /** + * provides a means to for subclasses to inject a different GUI + */ + protected BKUGUIFacade createGUI(Container contentPane, + Locale locale, + Style guiStyle, + URL backgroundImgURL, + AbstractHelpListener helpListener) { + return BKUGUIFactory.createGUI(contentPane, + locale, + guiStyle, + backgroundImgURL, + helpListener); + } + + protected STALPortType getSTALPort() throws MalformedURLException { + URL wsdlURL = getURLParameter(WSDL_URL, null); + log.debug("setting STAL WSDL: " + wsdlURL); + QName endpointName = new QName(STAL_WSDL_NS, STAL_SERVICE); + STALService stal = new STALService(wsdlURL, endpointName); + return stal.getSTALPort(); + } + + protected STALTranslator getSTALTranslator() { + return new STALTranslator(); + } + + protected void sendRedirect(String sessionId) { + try { + URL redirectURL = getURLParameter(REDIRECT_URL, sessionId); + String redirectTarget = getParameter(REDIRECT_TARGET); + if (redirectTarget == null) { + log.info("Done. Redirecting to " + redirectURL + " ..."); + getAppletContext().showDocument(redirectURL); + } else { + log.info("Done. Redirecting to " + redirectURL + " (target=" + redirectTarget + ") ..."); + getAppletContext().showDocument(redirectURL, redirectTarget); + } + } catch (MalformedURLException ex) { + log.warn("Failed to redirect: " + ex.getMessage(), ex); + // gui.showErrorDialog(errorMsg, okListener, actionCommand) + } } } diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html index c8bd99d3..4a768f91 100644 --- a/BKUApplet/src/test/resources/appletTest.html +++ b/BKUApplet/src/test/resources/appletTest.html @@ -18,7 +18,7 @@
diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml index 0f5757b8..5fd142a2 100644 --- a/BKULocal/pom.xml +++ b/BKULocal/pom.xml @@ -9,7 +9,7 @@ BKULocal war BKU Local - 1.0.4-SNAPSHOT + 1.0.2-SNAPSHOT scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java index 91d0aba0..61cc7c4c 100644 --- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java +++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java @@ -22,7 +22,6 @@ import at.gv.egiz.stal.QuitRequest; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; -import at.gv.egiz.stal.ext.APDUScriptRequest; import java.util.List; import javax.swing.JDialog; diff --git a/BKULocalApp/pom.xml b/BKULocalApp/pom.xml index 52bc4e36..79a270d8 100644 --- a/BKULocalApp/pom.xml +++ b/BKULocalApp/pom.xml @@ -5,10 +5,10 @@ 1.0.5-SNAPSHOT 4.0.0 - at.gv.egiz.bku + at.gv.egiz BKULocalApp BKU Local App - 1.0.4-SNAPSHOT + 1.0.2-SNAPSHOT @@ -76,7 +76,7 @@ at.gv.egiz BKULocal - 1.0.4-SNAPSHOT + 1.0.2-SNAPSHOT war diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml index c82cfc1e..fc5f04fa 100644 --- a/BKUOnline/pom.xml +++ b/BKUOnline/pom.xml @@ -1,4 +1,4 @@ - + bku @@ -56,25 +56,20 @@ 1.0.5-SNAPSHOT compile - - - at.gv.egiz - BKUApplet - 1.0.5-SNAPSHOT - provided - - + at.gv.egiz STALService 1.0.5-SNAPSHOT - at.gv.egiz STALXService 1.0.2-SNAPSHOT - + @@ -102,10 +97,30 @@ com.sun.xml.stream 1.0.1 + + + at.gv.egiz + BKUApplet + 1.0.5-SNAPSHOT + provided + + + at.gv.egiz + BKUAppletExt + 1.0.2-SNAPSHOT + provided + + + iaik + iaik_jce_me4se + provided + + - - Tomcat60 - scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKUOnline scm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKUOnline @@ -117,75 +132,31 @@ maven-dependency-plugin - copyapplet-dependencies + copy_applet copy-dependencies ${project.build.directory}/${project.build.finalName}/applet - - at.gv.egiz - BKUApplet - true + at.gv.egiz,commons-logging,iaik + BKUApplet,BKUAppletExt,commons-logging,iaik_jce_me4se true - - - - copyapplet - - copy - - - ${project.build.directory}/${project.build.finalName}/applet - - - commons-logging - commons-logging - - - iaik - iaik_jce_me4se - - + true - + maven-war-plugin 2.0.2 - - true - + true - - ${project.version}-r${buildNumber} - + ${project.version}-r${buildNumber} @@ -211,7 +182,7 @@ - jaxb-generate + jaxb-generate-stal @@ -245,4 +216,7 @@ - \ No newline at end of file + + Tomcat60 + + diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java index d9be0981..c758bcee 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java +++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java @@ -133,6 +133,9 @@ public class BKURequestHandler extends SpringBKUServlet { .getFormData("appletHashDataDisplay"), charset); String localeFormParam = getStringFromStream(bindingProcessor .getFormData("locale"), charset); + String extension = getStringFromStream(bindingProcessor + .getFormData("appletExtension"), charset); + if (width != null) { try { log.trace("Found applet width parameter: " + width); diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java index a617c61f..81b70b7c 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java @@ -19,19 +19,17 @@ package at.gv.egiz.stal.service.impl; import at.gv.egiz.stal.ErrorResponse; import at.gv.egiz.stal.HashDataInput; -import at.gv.egiz.stal.InfoboxReadRequest; import at.gv.egiz.stal.QuitRequest; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.SignRequest; import at.gv.egiz.stal.service.translator.STALTranslator; import at.gv.egiz.stal.service.translator.TranslationException; -import at.gv.egiz.stal.service.types.InfoboxReadRequestType; import at.gv.egiz.stal.service.types.ObjectFactory; import at.gv.egiz.stal.service.types.QuitRequestType; import at.gv.egiz.stal.service.types.RequestType; import at.gv.egiz.stal.service.types.ResponseType; -import at.gv.egiz.stal.service.types.SignRequestType; +import at.gv.egiz.stalx.service.translator.STALXTranslationHandler; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -71,10 +69,12 @@ public class STALRequestBrokerImpl implements STALRequestBroker { if (timeoutMillisec <= 0) timeoutMillisec = DEFAULT_TIMEOUT_MS; timeout = timeoutMillisec; -// translator.registerTranslationHandler(handler); requests = new ArrayList>(); responses = new ArrayList>(); hashDataInputs = new ArrayList(); + + // register handler for STAL-X + translator.registerTranslationHandler(new STALXTranslationHandler()); } /** diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java index afeba9cb..a30c6bb2 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java @@ -18,6 +18,8 @@ package at.gv.egiz.stal.service.impl; //import at.buergerkarte.namespaces.cardchannel.service.CommandAPDUType; //import at.buergerkarte.namespaces.cardchannel.service.ScriptType; +import at.buergerkarte.namespaces.cardchannel.service.CommandAPDUType; +import at.buergerkarte.namespaces.cardchannel.service.ScriptType; import at.gv.egiz.bku.binding.BindingProcessor; import at.gv.egiz.bku.binding.BindingProcessorManager; import at.gv.egiz.bku.binding.Id; @@ -78,8 +80,10 @@ public class STALServiceImpl implements STALPortType { @Resource protected WebServiceContext wsContext; protected IdFactory idF = IdFactory.getInstance(); + /** JAXB ObjectFactories */ private at.gv.egiz.stal.service.types.ObjectFactory stalObjFactory = new at.gv.egiz.stal.service.types.ObjectFactory(); -// private at.buergerkarte.namespaces.cardchannel.service.ObjectFactory ccObjFactory = new at.buergerkarte.namespaces.cardchannel.service.ObjectFactory(); + /** don't confuse with at.buergerkarte.namespaces.cardchannel */ + private at.buergerkarte.namespaces.cardchannel.service.ObjectFactory ccObjFactory = new at.buergerkarte.namespaces.cardchannel.service.ObjectFactory(); @Override public GetNextRequestResponseType connect(String sessId) { @@ -331,12 +335,12 @@ public class STALServiceImpl implements STALPortType { if (responsesIn == null) { log.info("[TestSession] received CONNECT, return dummy requests "); -// ScriptType scriptT = ccObjFactory.createScriptType(); -// CommandAPDUType cmd = ccObjFactory.createCommandAPDUType(); -// cmd.setValue("TestSession CardChannelCMD 1234".getBytes()); -// scriptT.getResetOrCommandAPDUOrVerifyAPDU().add(cmd); -// reqs.add(ccObjFactory.createScript(scriptT)); - addDummyRequests(reqs); +// addDummyRequests(reqs); + ScriptType scriptT = ccObjFactory.createScriptType(); + CommandAPDUType cmd = ccObjFactory.createCommandAPDUType(); + cmd.setValue("TestSession CardChannelCMD 1234".getBytes()); + scriptT.getResetOrCommandAPDUOrVerifyAPDU().add(cmd); + reqs.add(ccObjFactory.createScript(scriptT)); } else if (responsesIn != null && responsesIn.size() > 0 && responsesIn.get(0).getValue() instanceof ErrorResponseType) { log.info("[TestSession] received ErrorResponse, return QUIT request"); QuitRequestType quitT = stalObjFactory.createQuitRequestType(); diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java index 92559254..9caf950f 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALXJAXBContextFactory.java @@ -47,11 +47,11 @@ public class STALXJAXBContextFactory implements JAXBContextFactory { } List classes = new ArrayList(); classes.addAll(classesToBind); -// Class ccOF = at.buergerkarte.namespaces.cardchannel.service.ObjectFactory.class; -// if (!classes.contains(ccOF)) { -// log.debug("adding " + ccOF + " to JAXBContext seed"); -// classes.add(ccOF); -// } + Class ccOF = at.buergerkarte.namespaces.cardchannel.service.ObjectFactory.class; + if (!classes.contains(ccOF)) { + log.debug("adding " + ccOF + " to JAXBContext seed"); + classes.add(ccOF); + } //TODO add typeReference? diff --git a/BKUOnline/src/main/webapp/applet.jsp b/BKUOnline/src/main/webapp/applet.jsp index 3bf0ff40..ada48f22 100644 --- a/BKUOnline/src/main/webapp/applet.jsp +++ b/BKUOnline/src/main/webapp/applet.jsp @@ -39,6 +39,16 @@ String backgroundImg = (String) session.getAttribute("appletBackground"); String guiStyle = (String) session.getAttribute("appletGuiStyle"); String locale = (String) session.getAttribute("locale"); + + String appletClass, appletArchive; + //if (Boolean.parseBoolean((String) session.getAttribute("appletExtension"))) { + if ("activation".equals(guiStyle)) { + appletArchive = "BKUAppletExt.jar"; + appletClass = "at.gv.egiz.bku.online.applet.ext.BKUAppletExt.class"; + } else { + appletArchive = "BKUApplet.jar"; + appletClass = "at.gv.egiz.bku.online.applet.BKUApplet.class"; + } %> - - - -

Security-Layer v1.2 Request Formular

+ + +

Security-Layer v1.2 Request Formular

@@ -110,7 +110,7 @@ SecureSignatureKeypair - Ich bin ein einfacher Text. + Ich bin ein einfacher Text. llöäü߀ @@ -120,7 +120,27 @@ - TestXHTML + + +

Heading3 large bold llöäü߀

+

Ich bin ein einfacher Text. llöäü߀

+

Ich bin ein einfacher Text. llöäü߀

+

Ich bin ein einfacher Text. llöäü߀

+ + + +
@@ -145,7 +165,8 @@ --> - + +
Request Parameters

tiny @@ -185,8 +206,9 @@ name="StylesheetURL" value="" id="StylesheetURL">

--> +

-
+
diff --git a/BKUOnline/src/main/webapp/applet.jsp b/BKUOnline/src/main/webapp/applet.jsp index 31f3362b..df0b3ca5 100644 --- a/BKUOnline/src/main/webapp/applet.jsp +++ b/BKUOnline/src/main/webapp/applet.jsp @@ -72,14 +72,13 @@ %> - diff --git a/BKUOnline/src/main/webapp/index.html b/BKUOnline/src/main/webapp/index.html index 5bc01297..b39dafb7 100644 --- a/BKUOnline/src/main/webapp/index.html +++ b/BKUOnline/src/main/webapp/index.html @@ -22,6 +22,7 @@ +
@@ -46,7 +47,7 @@

MOCCA Web Start

-

diff --git a/BKUOnline/src/main/webapp/js/deployJava_orig.js b/BKUOnline/src/main/webapp/js/deployJava_orig.js new file mode 100644 index 00000000..316fa278 --- /dev/null +++ b/BKUOnline/src/main/webapp/js/deployJava_orig.js @@ -0,0 +1,725 @@ +/* + * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * - Neither the name of Sun Microsystems nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Added by EGIZ: + * This file contains workarounds to + * [#423] Firefox 3.0.11 bug #498132 causes applet loading failure + * (lines 95-99) + * [#424] Web Start loading via java plugin (Sun deployment script) fails on WinXP/Vista + * (lines 501-506) + * + * features: + * [#425] Disable WebStart Launch Button for MacOS + * (lines 492-504) + * + */ + +/* + * deployJava.js + * + * This file is part of the Deployment Toolkit. It provides functions for web + * pages to detect the presence of a JRE, install the latest JRE, and easily run + * applets or Web Start programs. Usage guide may be found at http:///. + * + * The "live" copy of this file may be found at + * http://java.com/js/deployJava.js. + * You are encouraged to link directly to the live copy of the file. + * + * @version @(#)deployJava.js XXXXX + */ + +var deployJava={ + debug:null, + + myInterval:null, + preInstallJREList:null, + returnPage:null, + brand:null, + locale:null, + installType:null, + + EAInstallEnabled:false, + EarlyAccessURL:null, + + // GetJava page + getJavaURL:'http://java.sun.com/webapps/getjava/BrowserRedirect?host=java.com', + + // Apple redirect page + appleRedirectPage:'http://www.apple.com/support/downloads/', + oldMimeType:'application/npruntime-scriptable-plugin;DeploymentToolkit', + mimeType:'application/java-deployment-toolkit', + launchButtonPNG:'http://java.sun.com/products/jfc/tsc/articles/swing2d/webstart.png', + + getJREs:function(){ + var list=new Array(); + if(deployJava.isPluginInstalled()){ + var plugin=deployJava.getPlugin(); + var VMs=plugin.jvms; + for(var i=0;i'; + document.write(s); + } + if(!codebaseParam){ + document.write(''); + } + } + document.write('<'+'/'+'applet'+'>'); + }, + + versionCheck:function(versionPattern) + + { + var index=0; + var regex="^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?(\\*|\\+)?$"; + + var matchData=versionPattern.match(regex); + + if(matchData!=null){ + var familyMatch=true; + + var patternArray=new Array(); + + for(var i=1;i<'+'img '+'src="'+deployJava.launchButtonPNG+'" '+'border="0" /><'+'/'+'a'+'>'); + }, + + launch:function(jnlp){ + if(deployJava.isPluginInstalled()){ + return deployJava.getPlugin().launch(jnlp); + }else{ + document.location=jnlp;return true; + } + }, + + isPluginInstalled:function(){ + var plugin=deployJava.getPlugin(); + if(plugin&&plugin.jvms){ + return true; + }else{ + return false; + } + }, + + isAutoUpdateEnabled:function(){ + if(deployJava.isPluginInstalled()){ + return deployJava.getPlugin().isAutoUpdateEnabled(); + } + return false; + }, + + setAutoUpdateEnabled:function(){ + if(deployJava.isPluginInstalled()){ + return deployJava.getPlugin().setAutoUpdateEnabled(); + } + return false; + }, + + setInstallerType:function(type){ + deployJava.installType=type; + if(deployJava.isPluginInstalled()){ + return deployJava.getPlugin().setInstallerType(type); + } + return false; + }, + + setAdditionalPackages:function(packageList){ + if(deployJava.isPluginInstalled()){ + return deployJava.getPlugin().setAdditionalPackages( + packageList); + } + return false; + }, + + setEarlyAccess:function(enabled){ + deployJava.EAInstallEnabled=enabled; + }, + + isPlugin2:function(){ + if(deployJava.isPluginInstalled()){ + if(deployJava.versionCheck('1.6.0_10+')){ + try{ + return deployJava.getPlugin().isPlugin2(); + }catch(err){ + + } + } + } + return false; + }, + + + getPlugin:function(){ + deployJava.refresh(); + var ret=document.getElementById('deployJavaPlugin'); + return ret; + }, + + compareVersionToPattern:function(version,patternArray,familyMatch){ + var regex="^(\\d+)(?:\\.(\\d+)(?:\\.(\\d+)(?:_(\\d+))?)?)?$"; + var matchData=version.match(regex); + + if(matchData!=null){ + var index=0; + var result=new Array(); + + for(var i=1;ipatternArray[i]){ + return true; + } + } + + return true; + } + }else{ + return false; + } + }, + + + getBrowser:function(){ + var browser=navigator.userAgent.toLowerCase(); + + if(deployJava.debug){ + alert('userAgent -> '+browser); + } + + if((navigator.vendor)&& + (navigator.vendor.toLowerCase().indexOf('apple')!=-1)&& + (browser.indexOf('safari')!=-1)){ + if(deployJava.debug){ + alert('We claim to have detected "Safari".'); + } + return'Safari'; + }else if(browser.indexOf('msie')!=-1){ + if(deployJava.debug){ + alert('We claim to have detected "IE".'); + } + return'MSIE'; + }else if((browser.indexOf('mozilla')!=-1)|| + (browser.indexOf('firefox')!=-1)){ + if(deployJava.debug){ + alert('We claim to have detected a Netscape family browser.'); + } + return'Netscape Family'; + }else{ + if(deployJava.debug){ + alert('We claim to have failed to detect a browser.'); + } + return'?'; + } + }, + + + testUsingActiveX:function(version){ + var objectName='JavaWebStart.isInstalled.'+version+'.0'; + + if(!ActiveXObject){ + if(deployJava.debug){ + alert('Browser claims to be IE, but no ActiveXObject object?'); + } + return false; + } + + try{ + return(new ActiveXObject(objectName)!=null); + }catch(exception){ + return false; + } + }, + + + testForMSVM:function(){ + var clsid='{08B0E5C0-4FCB-11CF-AAA5-00401C608500}'; + + if(typeof oClientCaps!='undefined'){ + var v=oClientCaps.getComponentVersion(clsid,"ComponentID"); + if((v=='')||(v=='5,0,5000,0')){ + return false; + }else{ + return true; + } + }else{ + return false; + } + }, + + + testUsingMimeTypes:function(version){ + if(!navigator.mimeTypes){ + if(deployJava.debug){ + alert('Browser claims to be Netscape family, but no mimeTypes[] array?'); + } + return false; + } + + for(var i=0;ib[0])return true; + if(a[0]b[1])return true; + if(a[1]b[2])return true; + if(a[2]'+ + '<'+'/'+'object'+'>'); + }else if(browser=='Netscape Family'){ + deployJava.writeEmbedTag(); + } + }, + + refresh:function(){ + navigator.plugins.refresh(false);var browser=deployJava.getBrowser();if(browser=='Netscape Family'){ + var plugin=document.getElementById('deployJavaPlugin');if(plugin==null){ + deployJava.writeEmbedTag(); + } + } + }, + + writeEmbedTag:function(){ + var written=false;if(navigator.mimeTypes!=null){ + for(var i=0;i