summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java158
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java24
-rw-r--r--BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java70
-rw-r--r--BKUApplet/src/main/resources/simplelog.properties2
-rw-r--r--BKUApplet/src/test/resources/appletTest.html9
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java140
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java14
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java33
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java200
-rw-r--r--BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties10
-rw-r--r--BKUCommonGUI/src/main/resources/images/help.pngbin0 -> 746 bytes
-rw-r--r--BKUOnline/src/main/webapp/appletPage.jsp7
12 files changed, 465 insertions, 202 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 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 @@
<center>
<applet code="at.gv.egiz.bku.online.applet.BKUApplet.class"
archive="../BKUApplet-1.0-SNAPSHOT.jar, ../test-libs/commons-logging-1.1.1.jar , ../test-libs/iaik_jce_me4se-3.04.jar"
- width=190 height=130>
- <param name="GuiStyle" value="simple"/>
+ width=300 height=200>
+ <param name="GuiStyle" value="advanced"/>
<param name="Background" value="http://localhost:3495/DemoIntegration/mocca_background.png"/>
- <param name="WSDL_URL" value="http://localhost:3495/BKUOnline-1.0-SNAPSHOT/stal?wsdl"/>
+ <param name="WSDL_URL" value="http://localhost:3495/stal?wsdl"/>
+ <param name="HelpURL" value="http://localhost:3495/help"/>
<param name="HashDataDisplay" value="internal"/>
<!--param name="HashDataURL" value="http://localhost:3495/BKUOnline-1.0-SNAPSHOT/hashDataInput"/-->
<param name="SessionId" value="TestSession"/>
- <param name="RedirectURL" value="http://localhost:3495/BKUOnline-1.0-SNAPSHOT/bkuResult"/>
+ <param name="RedirectURL" value="http://localhost:3495/bkuResult"/>
</applet>
</center>
</body>
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=<html>Bitte warten...</html>
-message.insertcard=<html>Bitte B\u00FCrgerkarte in den Kartenleser stecken</html>
-message.enterpin=<html>Bitte {0} eingeben</html>
-message.hashdatalink=<html><a href=\"anzeige\">Signaturdaten anzeigen...</a></html>
-message.hashdata=<html>Ein Signaturdatenobjekt:</html>
+message.insertcard=<html>Bitte die B\u00FCrgerkarte in den Kartenleser stecken</html>
+message.enterpin=<html>{0} eingeben</html>
+message.hashdatalink=<html><a href=\"anzeige\">Signaturdaten anzeigen</a></html>
+message.hashdata=<html>Signaturdaten:</html>
#message.hashdata=<html>Referenz Id: {0}</html>
-message.hashdatalist=<html>{0} Signaturdatenobjekte:</html>
+message.hashdatalist=<html>{0} Signaturdaten:</html>
message.retries=<html>Noch {0} Versuch(e)</html>
message.overwrite=<html>M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?</html>
label.pin=<html>{0}:</html>
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
--- /dev/null
+++ b/BKUCommonGUI/src/main/resources/images/help.png
Binary files 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'
};