diff options
author | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-11-18 08:03:35 +0000 |
---|---|---|
committer | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2008-11-18 08:03:35 +0000 |
commit | 28e81afd92a6568ff78736b72c5257a86c0b9b91 (patch) | |
tree | 012aaf1c1fc8f79c47309950f5be437c9f58a6a9 /BKUApplet/src/main/java | |
parent | e77343708ec9b74aed7256d72982e4fce4be80d8 (diff) | |
download | mocca-28e81afd92a6568ff78736b72c5257a86c0b9b91.tar.gz mocca-28e81afd92a6568ff78736b72c5257a86c0b9b91.tar.bz2 mocca-28e81afd92a6568ff78736b72c5257a86c0b9b91.zip |
GUI refactoring 1
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@177 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUApplet/src/main/java')
3 files changed, 24 insertions, 19 deletions
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 f862360b..b2f9f89c 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,18 +192,19 @@ 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)) { +// 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); 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, AppletHashDataDisplay.DISPLAY.frame); + AppletHashDataDisplay handler = new AppletHashDataDisplay(stalPort, sessionId); addRequestHandler(SignRequest.class, handler); } } 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 index 29a60f1d..ba502906 100644 --- 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 @@ -50,33 +50,32 @@ import java.security.NoSuchAlgorithmException; */ public class AppletHashDataDisplay extends SignRequestHandler { - public static enum DISPLAY { - applet, frame - } private static final Log log = LogFactory.getLog(AppletHashDataDisplay.class); protected STALPortType stalPort; protected String sessId; - protected DISPLAY display; - public AppletHashDataDisplay(STALPortType stalPort, String sessId, DISPLAY display) { + 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; - this.display = display; } + /** + * TODO don't throw exceptions + * @param signedReferences + * @throws java.security.DigestException + * @throws java.lang.Exception + */ @Override public void displayHashDataInputs(List<ReferenceType> signedReferences) throws DigestException, Exception { List<GetHashDataInputResponseType.Reference> hdi = getHashDataInput(signedReferences); List<HashDataInput> verifiedHashDataInputs = verifyHashDataInput(signedReferences, hdi); - if (verifiedHashDataInputs.size() > 1) { - gui.showHashDataInputDialog(verifiedHashDataInputs, false, this, "ok"); - } else if (verifiedHashDataInputs.size() == 1) { - gui.showHashDataInputDialog(verifiedHashDataInputs, display==DISPLAY.frame, this, "ok"); + if (verifiedHashDataInputs.size() > 0) { + gui.showHashDataInputDialog(verifiedHashDataInputs, this, "ok"); } else { throw new Exception("No signature data (apart from any QualifyingProperties or a Manifest)"); } @@ -111,6 +110,11 @@ public class AppletHashDataDisplay extends SignRequestHandler { } } } + + if (request.getReference().size() < 1) { + log.error("No signature data (apart from any QualifyingProperties or a Manifest) for session " + sessId); + throw new Exception("No signature data (apart from any QualifyingProperties or a Manifest)"); + } if (log.isDebugEnabled()) { log.debug("WebService call GetHashDataInput for " + request.getReference().size() + " references in session " + sessId); 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 7963768e..5b45c8e1 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 @@ -53,7 +53,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { 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"; +// public static final String HASHDATA_DISPLAY_INTERNAL = "internal"; public static final String HASHDATA_DISPLAY_BROWSER = "browser"; public static final String HASHDATA_DISPLAY_FRAME = "frame"; @@ -106,8 +106,8 @@ public class BKUApplet extends JApplet implements AppletParameterProvider { } log.debug("setting locale to " + getLocale()); - BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle); - gui.init(getContentPane(), getLocale(), backgroundImgURL, helpListener); + BKUGUIFacade gui = BKUGUIFactory.createGUI(getContentPane(), getLocale(), guiStyle, backgroundImgURL, helpListener); +// gui.init(getContentPane(), getLocale(), BKUGUIFacade.Style.advanced, backgroundImgURL, helpListener); worker = new AppletBKUWorker(gui, getAppletContext(), this); } |