summaryrefslogtreecommitdiff
path: root/BKUCommonGUI/src/main/java/at/gv/egiz
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/java/at/gv/egiz
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/java/at/gv/egiz')
-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
3 files changed, 367 insertions, 289 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());
}
}