summaryrefslogtreecommitdiff
path: root/BKUCommonGUI/src/main
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-03-18 22:27:28 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-03-18 22:27:28 +0000
commit2a1df5e58e44f8d77f34eb80df74e8c0d27caceb (patch)
tree5603a81674a1fe60373ba0a3ca37b03473eeb92a /BKUCommonGUI/src/main
parent2f49ed7ea3649a51a9457b99004c8cb0ca443432 (diff)
downloadmocca-2a1df5e58e44f8d77f34eb80df74e8c0d27caceb.tar.gz
mocca-2a1df5e58e44f8d77f34eb80df74e8c0d27caceb.tar.bz2
mocca-2a1df5e58e44f8d77f34eb80df74e8c0d27caceb.zip
1.1-rc5 (pinProviderFactories, gui refactoring, signatureCard, secureViewer)
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@322 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUCommonGUI/src/main')
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java66
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java560
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java30
-rw-r--r--BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties28
-rw-r--r--BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties28
5 files changed, 403 insertions, 309 deletions
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 be5e3fc8..1043b6a1 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
@@ -36,6 +36,7 @@ public interface BKUGUIFacade {
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 ERR_PIN_TIMEOUT = "error.pin.timeout";
public static final String ERR_VIEWER = "error.viewer";
public static final String ERR_EXTERNAL_LINK = "error.external.link";
public static final String ERR_CONFIG = "error.config";
@@ -52,6 +53,7 @@ public interface BKUGUIFacade {
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_ENTRY_TIMEOUT = "title.entry.timeout";
public static final String TITLE_RETRY = "title.retry";
public static final String TITLE_WAIT = "title.wait";
public static final String TITLE_HASHDATA = "title.hashdata";
@@ -60,17 +62,22 @@ public interface BKUGUIFacade {
public static final String WINDOWTITLE_OVERWRITE = "windowtitle.overwrite";
public static final String WINDOWTITLE_VIEWER = "windowtitle.viewer";
public static final String WINDOWTITLE_HELP = "windowtitle.help";
- 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_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";
+
+ // removed message.* prefix to reuse keys as help keys
+ public static final String MESSAGE_WELCOME = "welcome";
+ public static final String MESSAGE_WAIT = "wait";
+ public static final String MESSAGE_INSERTCARD = "insertcard";
+ public static final String MESSAGE_CARD_NOT_SUPPORTED = "cardnotsupported";
+ public static final String MESSAGE_ENTERPIN = "enterpin";
+ public static final String MESSAGE_ENTERPIN_PINPAD = "enterpin.pinpad";
+ public static final String MESSAGE_HASHDATALINK = "hashdatalink";
+ public static final String MESSAGE_HASHDATALINK_TINY = "hashdatalink.tiny";
+ public static final String MESSAGE_HASHDATALIST = "hashdatalist";
+ public static final String MESSAGE_RETRIES = "retries";
+ public static final String MESSAGE_LAST_RETRY = "retries.last";
+ public static final String MESSAGE_OVERWRITE = "overwrite";
+ public static final String MESSAGE_HELP = "help";
+
public static final String WARNING_XHTML = "warning.xhtml";
public static final String LABEL_PIN = "label.pin";
public static final String LABEL_PINSIZE = "label.pinsize";
@@ -103,33 +110,48 @@ public interface BKUGUIFacade {
*/
public Locale getLocale();
- public void showWelcomeDialog();
+// public void showWelcomeDialog();
/**
*
* @param waitMessage if null, a simple 'please wait' text is displayed
*/
- public void showWaitDialog(String waitMessage);
+// public void showWaitDialog(String waitMessage);
+
+// public void showInsertCardDialog(ActionListener cancelListener, String actionCommand);
- public void showInsertCardDialog(ActionListener cancelListener, String actionCommand);
+// public void showCardNotSupportedDialog(ActionListener cancelListener, String actionCommand);
- public void showCardNotSupportedDialog(ActionListener cancelListener, String actionCommand);
+ public void showCardPINDialog(PINSpec pinSpec, int numRetries,
+ ActionListener okListener, String okCommand,
+ ActionListener cancelListener, String cancelCommand);
- public void showCardPINDialog(PINSpec pinSpec, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand);
+// public void showCardPINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand);
- public void showCardPINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand);
+ public void showSignaturePINDialog(PINSpec pinSpec, int numRetries, ActionListener signListener, String signCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand);
- public void showSignaturePINDialog(PINSpec pinSpec, ActionListener signListener, String signCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand);
+// public void showSignaturePINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand);
- public void showSignaturePINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand);
+// public void showPinpadSignaturePINDialog(PINSpec pinSpec, int retries);
public char[] getPin();
- public void showHashDataInputDialog(List<HashDataInput> signedReferences, ActionListener okListener, String okCommand);
+ public void showSecureViewer(List<HashDataInput> signedReferences,
+ ActionListener okListener, String okCommand);
- public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams, ActionListener okListener, String okCommand);
+ public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams,
+ ActionListener okListener, String okCommand);
public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams);
- public void showMessageDialog(String titleKey, String msgKey, Object[] msgParams, ActionListener okListener, String okCommand);
+ public void showMessageDialog(String titleKey,
+ String msgKey, Object[] msgParams,
+ String buttonKey,
+ ActionListener okListener, String okCommand);
+
+ public void showMessageDialog(String titleKey,
+ String msgKey, Object[] msgParams);
+
+ public void showMessageDialog(String titleKey,
+ String msgKey);
}
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 76b1d795..928be249 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
@@ -315,200 +315,204 @@ public class BKUGUIImpl implements BKUGUIFacade {
return messages.containsKey(key);
}
- @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();
-
- helpListener.setHelpTopic(HELP_WELCOME);
-
- JLabel welcomeMsgLabel = new JLabel();
- welcomeMsgLabel.setFont(welcomeMsgLabel.getFont().deriveFont(welcomeMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
-
- if (renderHeaderPanel) {
- titleLabel.setText(getMessage(TITLE_WELCOME));
- welcomeMsgLabel.setText(getMessage(MESSAGE_WAIT));
- } else {
- welcomeMsgLabel.setText(getMessage(TITLE_WELCOME));
- }
-
- GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
- mainPanel.setLayout(mainPanelLayout);
-
- 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();
-
- }
- });
- }
-
- @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();
-
- if (renderHeaderPanel) {
- titleLabel.setText(getMessage(TITLE_INSERTCARD));
- }
-
- helpListener.setHelpTopic(HELP_INSERTCARD);
-
- JLabel insertCardMsgLabel = new JLabel();
- insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- insertCardMsgLabel.setText(getMessage(MESSAGE_INSERTCARD));
-
- GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
- mainPanel.setLayout(mainPanelLayout);
-
- GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup()
- .addComponent(insertCardMsgLabel);
- GroupLayout.ParallelGroup messageVertical = mainPanelLayout.createParallelGroup()
- .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.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD));
- cancelButton.setText(getMessage(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();
- }
- });
- }
+// @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();
+//
+// helpListener.setHelpTopic(HELP_WELCOME);
+//
+// JLabel welcomeMsgLabel = new JLabel();
+// welcomeMsgLabel.setFont(welcomeMsgLabel.getFont().deriveFont(welcomeMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+//
+// if (renderHeaderPanel) {
+// titleLabel.setText(getMessage(TITLE_WELCOME));
+// welcomeMsgLabel.setText(getMessage(MESSAGE_WAIT));
+// } else {
+// welcomeMsgLabel.setText(getMessage(TITLE_WELCOME));
+// }
+//
+// GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+// mainPanel.setLayout(mainPanelLayout);
+//
+// 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();
+//
+// }
+// });
+// }
+
+// @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();
+//
+// if (renderHeaderPanel) {
+// titleLabel.setText(getMessage(TITLE_INSERTCARD));
+// }
+//
+// helpListener.setHelpTopic(HELP_INSERTCARD);
+//
+// JLabel insertCardMsgLabel = new JLabel();
+// insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+// insertCardMsgLabel.setText(getMessage(MESSAGE_INSERTCARD));
+//
+// GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+// mainPanel.setLayout(mainPanelLayout);
+//
+// GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup()
+// .addComponent(insertCardMsgLabel);
+// GroupLayout.ParallelGroup messageVertical = mainPanelLayout.createParallelGroup()
+// .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.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD));
+// cancelButton.setText(getMessage(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();
-
- JLabel insertCardMsgLabel = new JLabel();
- insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
-
- if (renderHeaderPanel) {
- titleLabel.setText(getMessage(TITLE_CARD_NOT_SUPPORTED));
- insertCardMsgLabel.setText(getMessage(MESSAGE_INSERTCARD));
- } else {
- insertCardMsgLabel.setText(getMessage(TITLE_CARD_NOT_SUPPORTED));
- }
-
- helpListener.setHelpTopic(HELP_CARDNOTSUPPORTED);
-
- 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.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD));
- cancelButton.setText(getMessage(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) {
+// @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();
+//
+// JLabel insertCardMsgLabel = new JLabel();
+// insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+//
+// if (renderHeaderPanel) {
+// titleLabel.setText(getMessage(TITLE_CARD_NOT_SUPPORTED));
+// insertCardMsgLabel.setText(getMessage(MESSAGE_INSERTCARD));
+// } else {
+// insertCardMsgLabel.setText(getMessage(TITLE_CARD_NOT_SUPPORTED));
+// }
+//
+// helpListener.setHelpTopic(HELP_CARDNOTSUPPORTED);
+//
+// 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.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD));
+// cancelButton.setText(getMessage(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();
+// }
+// });
+// }
+
+ @Override
+ public 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");
@@ -534,7 +538,7 @@ public class BKUGUIImpl implements BKUGUIFacade {
JButton okButton = new JButton();
okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD));
okButton.setText(getMessage(BUTTON_OK));
- okButton.setEnabled(false);
+ okButton.setEnabled(pinSpec.getMinLength() <= 0);
okButton.setActionCommand(okCommand);
okButton.addActionListener(okListener);
@@ -681,27 +685,30 @@ public class BKUGUIImpl implements BKUGUIFacade {
});
}
- @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 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) {
+ public 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) {
+// 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");
@@ -726,7 +733,7 @@ public class BKUGUIImpl implements BKUGUIFacade {
JButton signButton = new JButton();
signButton.setFont(signButton.getFont().deriveFont(signButton.getFont().getStyle() & ~java.awt.Font.BOLD));
signButton.setText(getMessage(BUTTON_SIGN));
- signButton.setEnabled(false);
+ signButton.setEnabled(pinSpec.getMinLength() <= 0);
signButton.setActionCommand(signCommand);
signButton.addActionListener(signListener);
@@ -888,7 +895,7 @@ public class BKUGUIImpl implements BKUGUIFacade {
final ActionListener okListener, final String okCommand) {
showMessageDialog(TITLE_ERROR, ERROR_COLOR,
- errorMsgKey, errorMsgParams, okListener, okCommand);
+ errorMsgKey, errorMsgParams, BUTTON_OK, okListener, okCommand);
}
@Override
@@ -896,22 +903,45 @@ public class BKUGUIImpl implements BKUGUIFacade {
final String errorMsgKey, final Object[] errorMsgParams) {
showMessageDialog(TITLE_ERROR, ERROR_COLOR,
- errorMsgKey, errorMsgParams, null, null);
+ errorMsgKey, errorMsgParams, null, null, null);
}
@Override
public void showMessageDialog(
final String titleKey,
final String msgKey, final Object[] msgParams,
+ final String buttonKey,
final ActionListener okListener, final String okCommand) {
showMessageDialog(titleKey, null,
- msgKey, msgParams, okListener, okCommand);
+ msgKey, msgParams, buttonKey, okListener, okCommand);
+ }
+
+ @Override
+ public void showMessageDialog(
+ final String titleKey,
+ final String msgKey, final Object[] msgParams) {
+
+ showMessageDialog(titleKey, null,
+ msgKey, msgParams, null, null, null);
+ }
+
+ @Override
+ public void showMessageDialog(
+ final String titleKey, final String msgKey) {
+
+ showMessageDialog(titleKey, null,
+ msgKey, null, null, null, null);
}
+ /**
+ *
+ * @param buttonKey if null defaults to BUTTON_OK
+ */
private void showMessageDialog(
final String titleKey, final Color titleColor,
final String msgKey, final Object[] msgParams,
+ final String buttonKey,
final ActionListener okListener, final String okCommand) {
log.debug("scheduling message dialog");
@@ -972,7 +1002,7 @@ public class BKUGUIImpl implements BKUGUIFacade {
if (okListener != null) {
JButton okButton = new JButton();
okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD));
- okButton.setText(getMessage(BUTTON_OK));
+ okButton.setText(getMessage((buttonKey != null) ? buttonKey : BUTTON_OK));
okButton.setActionCommand(okCommand);
okButton.addActionListener(okListener);
@@ -993,57 +1023,57 @@ public class BKUGUIImpl implements BKUGUIFacade {
});
}
- @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();
-
- if (renderHeaderPanel) {
- titleLabel.setText(getMessage(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) {
- waitMsgLabel.setText("<html>" + waitMessage + "</html>");
- } else {
- waitMsgLabel.setText(getMessage(MESSAGE_WAIT));
- }
-
- GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
- mainPanel.setLayout(mainPanelLayout);
-
- 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();
- }
- });
- }
+// @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();
+//
+// if (renderHeaderPanel) {
+// titleLabel.setText(getMessage(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) {
+// waitMsgLabel.setText("<html>" + waitMessage + "</html>");
+// } else {
+// waitMsgLabel.setText(getMessage(MESSAGE_WAIT));
+// }
+//
+// GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+// mainPanel.setLayout(mainPanelLayout);
+//
+// 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();
+// }
+// });
+// }
@Override
public char[] getPin() {
@@ -1062,7 +1092,7 @@ public class BKUGUIImpl implements BKUGUIFacade {
* @param okCommand
*/
@Override
- public void showHashDataInputDialog(final List<HashDataInput> signedReferences,
+ public void showSecureViewer(final List<HashDataInput> signedReferences,
final ActionListener okListener,
final String okCommand) {
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
index 87b636f0..13aaf870 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java
@@ -35,6 +35,7 @@ class PINDocument extends PlainDocument {
protected Pattern pinPattern;
protected JButton enterButton;
protected Document compareTo;
+ protected Document oldPin;
public PINDocument(PINSpec pinSpec, JButton enterButton) {
this.pinSpec = pinSpec;
@@ -46,11 +47,30 @@ class PINDocument extends PlainDocument {
this.enterButton = enterButton;
}
+ /**
+ *
+ * @param pinSpec
+ * @param enterButton
+ * @param compareTo enable enterButton iff this pinDocument's pin equals to compareTo's pin. may be null
+ */
public PINDocument(PINSpec pinSpec, JButton enterButton, Document compareTo) {
this(pinSpec, enterButton);
this.compareTo = compareTo;
}
+ /**
+ *
+ * @param pinSpec
+ * @param enterButton may be null
+ * @param compareTo enable enterButton iff this pinDocument's pin equals to compareTo's pin. may be null
+ * @param oldPin enable enterButton iff oldPin meets the pinSpec pin length requirements, may be null
+ */
+ public PINDocument(PINSpec pinSpec, JButton enterButton, Document compareTo, Document oldPin) {
+ this(pinSpec, enterButton);
+ this.compareTo = compareTo;
+ this.oldPin = oldPin;
+ }
+
@Override
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
if (pinSpec.getMaxLength() < 0 || pinSpec.getMaxLength() >= (getLength() + str.length())) {
@@ -66,7 +86,10 @@ class PINDocument extends PlainDocument {
}
}
if (enterButton != null) {
- enterButton.setEnabled(getLength() >= pinSpec.getMinLength() && compare());
+ enterButton.setEnabled(
+ (oldPin == null || oldPin.getLength() >= pinSpec.getMinLength()) &&
+ getLength() >= pinSpec.getMinLength() &&
+ compare());
}
}
@@ -74,7 +97,10 @@ class PINDocument extends PlainDocument {
public void remove(int offs, int len) throws BadLocationException {
super.remove(offs, len);
if (enterButton != null) {
- enterButton.setEnabled(getLength() >= pinSpec.getMinLength() && compare());
+ enterButton.setEnabled(
+ (oldPin == null || oldPin.getLength() >= pinSpec.getMinLength()) &&
+ getLength() >= pinSpec.getMinLength() &&
+ compare());
}
}
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 1e0bc9f5..6d651b2d 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
@@ -20,6 +20,7 @@ title.cardnotsupported=<html>Die Karte wird nicht unterst\u00FCtzt</html>
title.cardpin=<html>Karte wird gelesen</html>
title.sign=<html>Signatur erstellen</html>
title.error=<html>Fehler</html>
+title.entry.timeout=<html>Zeit\u00FCberschreitung</html>
title.retry=<html>Falsche PIN</html>
title.wait=<html>Bitte warten</html>
title.hashdata=<html>Signaturdaten</html>
@@ -28,19 +29,25 @@ windowtitle.savedir=Signaturdaten in Verzeichnis speichern
windowtitle.overwrite=Datei \u00FCberschreiben?
windowtitle.viewer=Signaturdaten
windowtitle.help=Hilfe zur B\u00FCrgerkarte
-message.wait=<html>Bitte warten...</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.hashdatalink.tiny=<html><a href=\"anzeige\">Signaturdaten</a></html>
+
+# removed message.* prefix to reuse keys as help keys
+welcome=<html>Bitte warten...</html>
+wait=<html>Bitte warten...</html>
+cardnotsupported=<html>Bitte die B\u00FCrgerkarte in den Kartenleser stecken</html>
+insertcard=<html>Bitte die B\u00FCrgerkarte in den Kartenleser stecken</html>
+enterpin=<html>{0} eingeben</html>
+enterpin.pinpad=<html>{0} ({1} stellig) am Kartenleser eingeben</html>
+hashdatalink=<html><a href=\"anzeige\">Signaturdaten anzeigen</a></html>
+hashdatalink.tiny=<html><a href=\"anzeige\">Signaturdaten</a></html>
#message.hashdata=<html>Hinweis: Dies ist eine Voransicht des zu signierenden Inhalts. F\u00FCr eine standardkonforme Darstellung siehe Hilfe (i).</html>
#message.hashdata=<html>Dies ist eine Voransicht des zu signierenden Inhaltes. F\u00FCr Details siehe Hilfe (i).</html>
#verwenden sie bitte die von ihrem System zur Verf\u00FCgung gestellte {0} Anwendung.
-message.hashdatalist=<html>{0} Signaturdaten:</html>
-message.retries.last=<html>Letzter Versuch!</html>
-message.retries=<html>Noch {0} Versuche</html>
-message.overwrite=<html>M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?</html>
-message.help=<html>Hilfe zu {0}</html>
+hashdatalist=<html>{0} Signaturdaten:</html>
+retries.last=<html>Letzter Versuch!</html>
+retries=<html>Noch {0} Versuche</html>
+overwrite=<html>M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?</html>
+help=<html>Hilfe zu {0}</html>
+
warning.xhtml=<html>Hinweis: Dies ist eine Voransicht des zu signierenden Inhalts. F\u00FCr eine standardkonforme Darstellung siehe Hilfe (i).</html>
label.pin=<html>{0}:</html>
label.pinsize=<html>({0} stellig)</html>
@@ -73,6 +80,7 @@ error.unknown=<html>Ein Fehler trat auf</html>
error.test=<html>Fehler1 {0} - Fehler2 {1}</html>
error.card.locked=<html>B\u00FCrgerkarte ist gesperrt</html>
error.card.notactivated=<html>B\u00FCrgerkartenfunktion ist nicht aktiviert</html>
+error.pin.timeout=<html>Zeit\u00FCberschreitung bei Eingabe der PIN</html>
error.viewer=Der Inhalt kann nicht dargestellt werden: {0}
error.external.link=<html>Externer Link {0} wird nicht ge\u00F6ffnet</html>
error.config=<html>Fehlerhafte Konfiguration des Systems: {0}</html>
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 4fbccd5b..2fb66969 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
@@ -20,6 +20,7 @@ title.cardnotsupported=<html>This card is not supported</html>
title.cardpin=<html>Reading card</html>
title.sign=<html>Create signature</html>
title.error=<html>Error</html>
+title.entry.timeout=<html>Timeout</html>
title.retry=<html>Wrong PIN</html>
title.wait=<html>Please wait</html>
title.hashdata=<html>Signature data</html>
@@ -28,17 +29,23 @@ windowtitle.savedir=Save signature data to directory
windowtitle.overwrite=Overwrite file?
windowtitle.viewer=Signature data
windowtitle.help=Citizen card help
-message.wait=<html>Please wait...</html>
-message.insertcard=<html>Please insert your citizen card into the reader</html>
-message.enterpin=<html>Enter {0}</html>
-message.hashdatalink=<html><a href=\"anzeige\">Display signature data</a></html>
-message.hashdatalink.tiny=<html><a href=\"anzeige\">signature data</a></html>
+
+# removed message.* prefix to reuse keys as help keys
+welcome=<html>Please wait...</html>
+wait=<html>Please wait...</html>
+insertcard=<html>Please insert your citizen card into the reader</html>
+cardnotsupported=<html>Please insert your citizen card into the reader</html>
+enterpin=<html>Enter {0}</html>
+enterpin.pinpad=<html>Enter {0} ({1} digits) on card reader pinpad</html>
+hashdatalink=<html><a href=\"anzeige\">Display signature data</a></html>
+hashdatalink.tiny=<html><a href=\"anzeige\">signature data</a></html>
#message.hashdata=<html>Remark: This is a preview of the data to-be signed. For standards compliant display see help.</html>
-message.hashdatalist=<html>{0} signature data objects:</html>
-message.retries.last=<html>Last try!</html>
-message.retries=<html>{0} tries left</html>
-message.overwrite=<html>Overwrite {0}?</html>
-message.help=<html>Help topic {0}</html>
+hashdatalist=<html>{0} signature data objects:</html>
+retries.last=<html>Last try!</html>
+retries=<html>{0} tries left</html>
+overwrite=<html>Overwrite {0}?</html>
+help=<html>Help topic {0}</html>
+
warning.xhtml=<html>Remark: This is a preview of the data to-be signed. For standards compliant display see help.</html>
label.pin=<html>{0}:</html>
label.pinsize=<html>({0} digits)</html>
@@ -71,6 +78,7 @@ error.unknown=<html>An error occured</html>
error.test=<html>Error1 {0} - Error2 {1}</html>
error.card.locked=<html>Citizen card is locked</html>
error.card.notactivated=<html>Citizen card not activated</html>
+error.pin.timeout=<html>Timeout during PIN entry</html>
error.viewer=Failed to display contents: {0}
error.external.link=<html>Cannot open external link {0}</html>
error.config=<html>Incorrect system configuration: {0}</html>