diff options
6 files changed, 56 insertions, 4 deletions
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java index 95ac3553..94673266 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 @@ -26,6 +26,7 @@ import java.util.Locale; import javax.net.ssl.HttpsURLConnection; import javax.swing.JApplet; +import javax.swing.JPanel; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -35,6 +36,7 @@ import at.gv.egiz.bku.gui.BKUGUIImpl; import at.gv.egiz.stal.service.STALPortType; import at.gv.egiz.stal.service.STALService; import java.applet.AppletContext; +import java.awt.Color; import java.awt.Container; import javax.xml.namespace.QName; @@ -44,6 +46,8 @@ import javax.xml.namespace.QName; */ public class BKUApplet extends JApplet { + private static final long serialVersionUID = 1L; + private static Log log = LogFactory.getLog(BKUApplet.class); /** * Applet parameter keys @@ -56,6 +60,7 @@ public class BKUApplet extends JApplet { public final static String HELP_URL = "HelpURL"; public final static String SESSION_ID = "SessionID"; public static final String BACKGROUND_IMG = "Background"; + public static final String BACKGROUND_COLOR = "BackgroundColor"; public static final String REDIRECT_URL = "RedirectURL"; public static final String REDIRECT_TARGET = "RedirectTarget"; public static final String HASHDATA_DISPLAY_FRAME = "frame"; @@ -82,6 +87,23 @@ public class BKUApplet extends JApplet { protected AppletBKUWorker worker; protected Thread workerThread; + /* (non-Javadoc) + * @see java.applet.Applet#getParameterInfo() + */ + @Override + public String[][] getParameterInfo() { + return new String[][] { + {WSDL_URL, "url", "URL of the WSDL of the MOCCA server side STAL"}, + {REDIRECT_URL, "url", "URL to redirect the browser to when finished"}, + {REDIRECT_TARGET, "frame target", "name of the target frame for redirection when finished"}, + {LOCALE, "locale", "locale for UI localization (optional, default: system default)"}, + {GUI_STYLE, "simple, advanced, tiny", "GUI style (optional, default: simple)"}, + {BACKGROUND_COLOR, "#hhhhhh", "background color, e.g. '#333333' (optional, default: look and feel dependend)"}, + {BACKGROUND_IMG, "url", "URL of a background image for the GUI (optional, default: no image)"}, + {HELP_URL, "url", "URL for locating help files, e.g. '../help/' (no help provided if missing)"} + }; + } + /** * Factory method to create and wire HelpListener, GUI and BKUWorker. * (Config via applet parameters, see BKUApplet.* constants) @@ -130,7 +152,24 @@ public class BKUApplet extends JApplet { log.warn("failed to load help URL: " + ex.getMessage() + ", disabling help"); } - BKUGUIFacade gui = createGUI(getContentPane(), getLocale(), + // Note: We need a panel in order to be able to set the background properly. + // Setting the background without a panel has side effects with the + // different java plugins. + JPanel contentPanel = new JPanel(); + getContentPane().add(contentPanel); + + String backgroundColor = getParameter(BACKGROUND_COLOR); + if (backgroundColor != null && backgroundColor.startsWith("#")) { + try { + Color color = new Color(Integer.parseInt(backgroundColor.substring(1), 16)); + log.debug("setting background color to " + color); + contentPanel.setBackground(color); + } catch (NumberFormatException e) { + log.debug("failed to set background color '" + backgroundColor + "'"); + } + } + + BKUGUIFacade gui = createGUI(contentPanel, getLocale(), guiStyle, backgroundImgURL, helpListener); @@ -255,8 +294,8 @@ public class BKUApplet extends JApplet { throw ex; } } else { - log.error("applet paremeter " + urlParam + " not set"); - throw new MalformedURLException(urlParam + " not set"); + log.error("applet paremeter " + paramKey + " not set"); + throw new MalformedURLException(paramKey + " not set"); } } } 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 5ea2499a..35a53ff7 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 @@ -218,6 +218,7 @@ public class BKUGUIImpl implements BKUGUIFacade { log.debug("loading background " + background); contentPanel = new ImagePanel(background); } + contentPanel.setOpaque(false); mainPanel = new JPanel(); mainPanel.setOpaque(false); buttonPanel = new JPanel(); 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 333e3d70..f6d7a50c 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 @@ -130,6 +130,8 @@ public class BKURequestHandler extends SpringBKUServlet { .getFormData("appletHeight"), charset); String background = getStringFromStream(bindingProcessor .getFormData("appletBackground"), charset); + String backgroundColor = getStringFromStream(bindingProcessor + .getFormData("appletBackgroundColor"), charset); String guiStyle = getStringFromStream(bindingProcessor .getFormData("appletGuiStyle"), charset); String hashDataDisplay = getStringFromStream(bindingProcessor @@ -161,6 +163,10 @@ public class BKURequestHandler extends SpringBKUServlet { log.trace("Found applet background parameter: " + background); session.setAttribute("appletBackground", background); } + if (backgroundColor != null) { + log.trace("Faund applet background color parameter: " + backgroundColor); + session.setAttribute("appletBackgroundColor", backgroundColor); + } if (guiStyle != null) { log.trace("Found applet GUI style parameter: " + guiStyle); session.setAttribute("appletGuiStyle", guiStyle); diff --git a/BKUOnline/src/main/webapp/SLRequestForm.html b/BKUOnline/src/main/webapp/SLRequestForm.html index 997a3c82..f705a0cb 100644 --- a/BKUOnline/src/main/webapp/SLRequestForm.html +++ b/BKUOnline/src/main/webapp/SLRequestForm.html @@ -159,6 +159,9 @@ name="appletHeight" value="130" id="appletHeight"> <p><label for="appletBackground">Applet Background</label> <input name="appletBackground" value="" id="appletBackground"> + <p><label for="appletBackgroundColor">Applet Background Color</label> <input + name="appletBackgroundColor" value="" id="appletBackgroundColor"> + </p> <p> <label for="appletPage">Applet Page</label> diff --git a/BKUOnline/src/main/webapp/applet.jsp b/BKUOnline/src/main/webapp/applet.jsp index 1e38cc04..5b9f2274 100644 --- a/BKUOnline/src/main/webapp/applet.jsp +++ b/BKUOnline/src/main/webapp/applet.jsp @@ -36,9 +36,10 @@ : (Integer) session.getAttribute("appletWidth"); int height = session.getAttribute("appletHeight") == null ? 130 : (Integer) session.getAttribute("appletHeight"); - String backgroundImg = session.getAttribute("appletBackground") == null + String backgroundImg = session.getAttribute("appletBackground") == null ? "../img/chip32.png" : (String) session.getAttribute("appletBackground"); + String backgroundColor = (String) session.getAttribute("appletBackgroundColor"); String guiStyle = (String) session.getAttribute("appletGuiStyle"); String locale = (String) session.getAttribute("locale"); String extension = (String) session.getAttribute("extension"); @@ -91,6 +92,7 @@ GuiStyle : '<%=guiStyle%>', Locale : '<%=locale%>', Background : '<%=backgroundImg%>', + BackgroundColor : '<%=backgroundColor%>', WSDL_URL :'../stal;jsessionid=<%=session.getId()%>?wsdl', HelpURL : '../help/', SessionID : '<%=session.getId()%>', diff --git a/smcc/src/main/java/at/gv/egiz/smcc/ccid/ReaderFactory.java b/smcc/src/main/java/at/gv/egiz/smcc/ccid/ReaderFactory.java index e0625a53..32a9ce9f 100644 --- a/smcc/src/main/java/at/gv/egiz/smcc/ccid/ReaderFactory.java +++ b/smcc/src/main/java/at/gv/egiz/smcc/ccid/ReaderFactory.java @@ -61,6 +61,7 @@ public class ReaderFactory { // http://www.linux-club.de/viewtopic.php?f=61&t=101287&start=0 //old: REINER SCT CyberJack 00 00 //new (CCID): 0C4B/0300 Reiner-SCT cyberJack pinpad(a) 00 00 + //Mac "Snow Leopard": Reiner-SCT cyberJack pinpad(a) 00 00 //display: REINER SCT CyberJack 00 00 if(name.startsWith("gemplus gempc pinpad") || name.startsWith("gemalto gempc pinpad")) { reader = new GemplusGemPCPinpad(icc, ct); |