From 22001c93bca360d1b15c252cb22d2a4147ff350d Mon Sep 17 00:00:00 2001
From: clemenso
Date: Thu, 20 Aug 2009 16:24:55 +0000
Subject: [#430] Activation/PIN-management in MOCCA Web Start - new Modules:
smccSTALExt, BKUGuiExt in order not to depend on BKUAppletExt in BKULocal -
provide stal-request handler de-registration in abstractSMCCSTAL
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@448 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
BKUApplet/src/main/java/META-INF/MANIFEST.MF | 3 -
BKUAppletExt/pom.xml | 10 +
.../java/at/gv/egiz/bku/gui/ActivationGUI.java | 249 --------
.../at/gv/egiz/bku/gui/ActivationGUIFacade.java | 33 -
.../main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java | 70 ---
.../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 669 --------------------
.../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 117 ----
.../java/at/gv/egiz/bku/gui/PINSpecRenderer.java | 39 --
.../java/at/gv/egiz/bku/gui/PINStatusRenderer.java | 61 --
.../at/gv/egiz/bku/gui/PINStatusTableModel.java | 58 --
.../egiz/bku/online/applet/ActivationApplet.java | 2 +-
.../bku/online/applet/PINManagementBKUWorker.java | 16 +-
.../bku/smccstal/ext/CardMgmtRequestHandler.java | 177 ------
.../bku/smccstal/ext/GetPINStatusException.java | 41 --
.../smccstal/ext/ManagementPINProviderFactory.java | 262 --------
.../smccstal/ext/PINManagementRequestHandler.java | 244 --------
.../gv/egiz/bku/gui/ActivationMessages.properties | 69 ---
.../egiz/bku/gui/ActivationMessages_en.properties | 68 ---
.../java/at/gv/egiz/bku/gui/ActivationGuiTest.java | 62 --
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 202 -------
BKUCommonGUI/pom.xml | 2 +-
.../main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 2 +-
BKUGuiExt/pom.xml | 27 +
.../java/at/gv/egiz/bku/gui/ActivationGUI.java | 250 ++++++++
.../at/gv/egiz/bku/gui/ActivationGUIFacade.java | 34 ++
.../main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java | 71 +++
.../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 670 +++++++++++++++++++++
.../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 118 ++++
.../java/at/gv/egiz/bku/gui/PINSpecRenderer.java | 39 ++
.../java/at/gv/egiz/bku/gui/PINStatusRenderer.java | 61 ++
.../at/gv/egiz/bku/gui/PINStatusTableModel.java | 58 ++
.../gv/egiz/bku/gui/ActivationMessages.properties | 69 +++
.../egiz/bku/gui/ActivationMessages_en.properties | 68 +++
.../java/at/gv/egiz/bku/gui/ActivationGuiTest.java | 63 ++
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 203 +++++++
BKULocal/pom.xml | 25 +-
.../java/at/gv/egiz/bku/local/gui/GUIProxy.java | 55 ++
.../at/gv/egiz/bku/local/stal/BKUGuiProxy.java | 156 -----
.../at/gv/egiz/bku/local/stal/LocalBKUWorker.java | 6 +-
.../gv/egiz/bku/local/stal/LocalSTALFactory.java | 18 +-
.../bku/local/webapp/PINManagementServlet.java | 167 +++++
BKULocal/src/main/webapp/WEB-INF/web.xml | 10 +-
BKULocal/src/main/webapp/index.html | 7 +-
.../java/at/gv/egiz/bku/webstart/Launcher.java | 104 +++-
.../bku/webstart/gui/PINManagementInvoker.java | 71 +++
.../gv/egiz/bku/webstart/gui/TrayMenuListener.java | 75 ---
BKUWebStart/src/main/jnlp/resources/version.xml | 12 +-
.../at/gv/egiz/bku/webstart/messages.properties | 1 +
pom.xml | 2 +
.../at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java | 5 +
smccSTALExt/pom.xml | 27 +
.../egiz/bku/smccstal/CardMgmtRequestHandler.java | 177 ++++++
.../egiz/bku/smccstal/GetPINStatusException.java | 41 ++
.../bku/smccstal/ManagementPINProviderFactory.java | 262 ++++++++
.../bku/smccstal/PINManagementRequestHandler.java | 245 ++++++++
55 files changed, 2947 insertions(+), 2706 deletions(-)
delete mode 100644 BKUApplet/src/main/java/META-INF/MANIFEST.MF
delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java
delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java
delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java
delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java
delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java
delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java
delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java
delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java
delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java
delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java
delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java
delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java
delete mode 100644 BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties
delete mode 100644 BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties
delete mode 100644 BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java
delete mode 100644 BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
create mode 100644 BKUGuiExt/pom.xml
create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java
create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java
create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java
create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java
create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java
create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java
create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java
create mode 100644 BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java
create mode 100644 BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties
create mode 100644 BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties
create mode 100644 BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java
create mode 100644 BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
create mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/gui/GUIProxy.java
delete mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java
create mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/PINManagementServlet.java
create mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/PINManagementInvoker.java
delete mode 100644 BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/TrayMenuListener.java
create mode 100644 smccSTALExt/pom.xml
create mode 100644 smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java
create mode 100644 smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GetPINStatusException.java
create mode 100644 smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/ManagementPINProviderFactory.java
create mode 100644 smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java
diff --git a/BKUApplet/src/main/java/META-INF/MANIFEST.MF b/BKUApplet/src/main/java/META-INF/MANIFEST.MF
deleted file mode 100644
index 5e949512..00000000
--- a/BKUApplet/src/main/java/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,3 +0,0 @@
-Manifest-Version: 1.0
-Class-Path:
-
diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml
index 79fc5600..98502ab2 100644
--- a/BKUAppletExt/pom.xml
+++ b/BKUAppletExt/pom.xml
@@ -31,6 +31,16 @@
BKUApplet
1.2.2-SNAPSHOT
+
+ at.gv.egiz
+ BKUGuiExt
+ 1.2.2-SNAPSHOT
+
+
+ at.gv.egiz
+ smccSTALExt
+ 1.2.2-SNAPSHOT
+
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java
deleted file mode 100644
index 8134ac5f..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright 2008 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package at.gv.egiz.bku.gui;
-
-import java.awt.Container;
-import java.awt.Cursor;
-import java.awt.event.ActionListener;
-import java.net.URL;
-import java.text.MessageFormat;
-import java.util.Locale;
-import java.util.ResourceBundle;
-import javax.swing.GroupLayout;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JProgressBar;
-import javax.swing.LayoutStyle;
-import javax.swing.SwingUtilities;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class ActivationGUI extends CardMgmtGUI implements ActivationGUIFacade {
-
- public static final String TITLE_ACTIVATION = "title.activation";
- public static final String LABEL_ACTIVATION = "label.activation";
- public static final String LABEL_ACTIVATION_STEP = "label.activation.step";
- public static final String LABEL_ACTIVATION_IDLE = "label.activation.idle";
-
- public static final String HELP_ACTIVATION = "help.activation";
-
- protected JProgressBar progressBar;
-
- public ActivationGUI(Container contentPane,
- Locale locale,
- Style guiStyle,
- URL backgroundImgURL,
- AbstractHelpListener helpListener) {
- super(contentPane, locale, guiStyle, backgroundImgURL, helpListener);
-
- progressBar = new JProgressBar();
- }
-
- @Override
- public void showActivationProgressDialog(final int currentStep, final int maxProgress, final ActionListener cancelListener, final String cancelCommand) {
-
- log.debug("scheduling activation progress dialog (step " + currentStep + ")");
-
- SwingUtilities.invokeLater(new Runnable() {
-
- @Override
- public void run() {
-
- log.debug("show activation progress dialog (step " + currentStep + ")");
-
- mainPanel.removeAll();
- buttonPanel.removeAll();
-
- mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-
-
- JLabel infoLabel = new JLabel();
- infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
-
- if (renderHeaderPanel) {
- titleLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION));
- infoLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION));
- } else {
- infoLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION));
- }
-
- helpListener.setHelpTopic(HELP_ACTIVATION);
-
- progressBar.setIndeterminate(false);
- progressBar.setStringPainted(true);
- progressBar.setString(null); //reset to percentage
- progressBar.setMinimum(0);
- progressBar.setMaximum(maxProgress);
-
- JLabel stepLabel = new JLabel();
- stepLabel.setFont(stepLabel.getFont().deriveFont(stepLabel.getFont().getStyle() & ~java.awt.Font.BOLD, stepLabel.getFont().getSize()-2));
- String stepPattern = cardmgmtMessages.getString(LABEL_ACTIVATION_STEP);
- stepLabel.setText(MessageFormat.format(stepPattern, new Object[]{ currentStep }));
-
- GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
- mainPanel.setLayout(mainPanelLayout);
-
- GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup().addComponent(infoLabel);
- GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(infoLabel);
-
- if (!renderHeaderPanel) {
- infoHorizontal.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel);
- infoVertical.addComponent(helpLabel);
- }
-
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(infoHorizontal)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(stepLabel)
- .addComponent(progressBar)));
-
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createSequentialGroup()
- .addGroup(infoVertical)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addComponent(stepLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(progressBar)));
-
- JButton cancelButton = new JButton();
- cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD));
- cancelButton.setText(messages.getString(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 incrementProgress() {
- SwingUtilities.invokeLater(new Runnable() {
-
- @Override
- public void run() {
- progressBar.setValue(progressBar.getValue() + 1);
- }
- });
-
- }
-
- @Override
- public void showIdleDialog(final ActionListener cancelListener, final String cancelCommand) {
- log.debug("scheduling idle dialog");
-
- SwingUtilities.invokeLater(new Runnable() {
-
- @Override
- public void run() {
-
- log.debug("show idle dialog");
-
- mainPanel.removeAll();
- buttonPanel.removeAll();
-
- mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
-
-
- JLabel infoLabel = new JLabel();
- infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
-
- if (renderHeaderPanel) {
- titleLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION));
- infoLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION));
- } else {
- infoLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION));
- }
-
- helpListener.setHelpTopic(HELP_ACTIVATION);
-
- progressBar.setIndeterminate(true);
- progressBar.setStringPainted(true);
- progressBar.setString(""); //not string painted progressbar is smaller
-
- JLabel stepLabel = new JLabel();
- stepLabel.setFont(stepLabel.getFont().deriveFont(stepLabel.getFont().getStyle() & ~java.awt.Font.BOLD, stepLabel.getFont().getSize()-2));
- stepLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION_IDLE));
-
- GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
- mainPanel.setLayout(mainPanelLayout);
-
- GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup().addComponent(infoLabel);
- GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(infoLabel);
-
- if (!renderHeaderPanel) {
- infoHorizontal.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel);
- infoVertical.addComponent(helpLabel);
- }
-
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(infoHorizontal)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(stepLabel)
- .addComponent(progressBar)));
-
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createSequentialGroup()
- .addGroup(infoVertical)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addComponent(stepLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(progressBar)));
-
- JButton cancelButton = new JButton();
- cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD));
- cancelButton.setText(messages.getString(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();
-
- }
- });
-
- }
-}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java
deleted file mode 100644
index 860a1097..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2008 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package at.gv.egiz.bku.gui;
-
-import java.awt.event.ActionListener;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public interface ActivationGUIFacade extends BKUGUIFacade {
-
- public void showActivationProgressDialog(int currentStep, int maxProgress, ActionListener cancelListener, String cancelCommand);
-
- public void incrementProgress();
-
- public void showIdleDialog(ActionListener cancelListener, String cancelCommand);
-
-}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java
deleted file mode 100644
index ac9ab78b..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright 2008 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package at.gv.egiz.bku.gui;
-
-import java.awt.Container;
-import java.net.URL;
-import java.util.Locale;
-import java.util.ResourceBundle;
-
-/**
- * Common superclass for Activation and PinManagement GUIs
- *
- * @author Clemens Orthacker
- */
-public class CardMgmtGUI extends BKUGUIImpl {
-
- public static final String CARDMGMT_MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/ActivationMessages";
-
- protected ResourceBundle cardmgmtMessages;
-
- public CardMgmtGUI(Container contentPane,
- Locale locale,
- Style guiStyle,
- URL backgroundImgURL,
- AbstractHelpListener helpListener) {
- super(contentPane, locale, guiStyle, backgroundImgURL, helpListener);
-
- }
-
- @Override
- protected void loadMessageBundle(Locale locale) {
- super.loadMessageBundle(locale);
-
- if (locale != null) {
- Locale lang = new Locale(locale.getLanguage().substring(0,2));
- log.debug("loading applet resources for language: " + lang.toString());
- cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE, lang);
- } else {
- cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE);
- }
- }
-
- @Override
- protected String getMessage(String key) {
- if (super.hasMessage(key)) {
- return super.getMessage(key);
- }
- return cardmgmtMessages.getString(key);
- }
-
- @Override
- protected boolean hasMessage(String key) {
- return (cardmgmtMessages.containsKey(key) || super.hasMessage(key));
- }
-}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java
deleted file mode 100644
index 3b77daa5..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java
+++ /dev/null
@@ -1,669 +0,0 @@
-/*
- * Copyright 2008 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package at.gv.egiz.bku.gui;
-
-import at.gv.egiz.smcc.PINSpec;
-import java.awt.Container;
-import java.awt.Cursor;
-import java.awt.Font;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseMotionAdapter;
-import java.net.URL;
-import java.text.MessageFormat;
-import java.util.Locale;
-import java.util.Map;
-import javax.swing.GroupLayout;
-import javax.swing.JButton;
-import javax.swing.JLabel;
-import javax.swing.JPasswordField;
-import javax.swing.JScrollPane;
-import javax.swing.JTable;
-import javax.swing.LayoutStyle;
-import javax.swing.ListSelectionModel;
-import javax.swing.SwingUtilities;
-import javax.swing.event.ListSelectionEvent;
-import javax.swing.event.ListSelectionListener;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- * TODO pull out ResourceBundle to common superclass for activationGUI and pinMgmtGUI
- * @author Clemens Orthacker
- */
-public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFacade {
-
- protected static final Log log = LogFactory.getLog(PINManagementGUI.class);
-
- /** remember the pinfield to return to worker */
- protected JPasswordField oldPinField;
- /** remember the pinSpec to return to worker */
- protected PINSpec pinSpec;
-
- public PINManagementGUI(Container contentPane,
- Locale locale,
- Style guiStyle,
- URL backgroundImgURL,
- AbstractHelpListener helpListener) {
- super(contentPane, locale, guiStyle, backgroundImgURL, helpListener);
- }
-
- @Override
- public char[] getOldPin() {
- if (oldPinField != null) {
- char[] pin = oldPinField.getPassword();
- oldPinField = null;
- return pin;
- }
- return null;
- }
-
- @Override
- public PINSpec getSelectedPINSpec() {
- return pinSpec;
- }
-
- @Override
- public void showPINManagementDialog(final Map pins,
- final ActionListener activateListener,
- final String activateCmd,
- final String changeCmd,
- final String unblockCmd,
- final String verifyCmd,
- final ActionListener cancelListener,
- final String cancelCmd) {
-
- log.debug("scheduling PIN managment dialog");
-
- SwingUtilities.invokeLater(new Runnable() {
-
- @Override
- public void run() {
- log.debug("show PIN management dialog");
-
- mainPanel.removeAll();
- buttonPanel.removeAll();
-
- helpListener.setHelpTopic(HELP_PINMGMT);
-
- JLabel mgmtLabel = new JLabel();
- mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
-
- if (renderHeaderPanel) {
- titleLabel.setText(getMessage(TITLE_PINMGMT));
- String infoPattern = getMessage(MESSAGE_PINMGMT);
- mgmtLabel.setText(MessageFormat.format(infoPattern, pins.size()));
- } else {
- mgmtLabel.setText(getMessage(TITLE_PINMGMT));
- }
-
- final PINStatusTableModel tableModel = new PINStatusTableModel(pins);
- final JTable pinStatusTable = new JTable(tableModel);
- pinStatusTable.setDefaultRenderer(PINSpec.class, new PINSpecRenderer());
- pinStatusTable.setDefaultRenderer(STATUS.class, new PINStatusRenderer(cardmgmtMessages));
- pinStatusTable.setTableHeader(null);
- pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
-// pinStatusTable.addMouseMotionListener(new MouseMotionAdapter() {
-//
-// @Override
-// public void mouseMoved(MouseEvent e) {
-// if (pinStatusTable.columnAtPoint(e.getPoint()) == 0) {
-// pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
-// } else {
-// pinStatusTable.setCursor(Cursor.getDefaultCursor());
-// }
-// }
-// });
-
- final JButton activateButton = new JButton();
- activateButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD));
- activateButton.addActionListener(activateListener);
-
- pinStatusTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
- pinStatusTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
-
- @Override
- public void valueChanged(final ListSelectionEvent e) {
- //invoke later to allow thread to paint selection background
- SwingUtilities.invokeLater(new Runnable() {
-
- @Override
- public void run() {
- ListSelectionModel lsm = (ListSelectionModel) e.getSource();
- int selectionIdx = lsm.getMinSelectionIndex();
- if (selectionIdx >= 0) {
- pinSpec = (PINSpec) tableModel.getValueAt(selectionIdx, 0);
- STATUS status = (STATUS) tableModel.getValueAt(selectionIdx, 1);
-
- if (status == STATUS.NOT_ACTIV) {
- activateButton.setText(getMessage(BUTTON_ACTIVATE));
- activateButton.setEnabled(true);
- activateButton.setActionCommand(activateCmd);
- } else if (status == STATUS.BLOCKED) {
- activateButton.setText(getMessage(BUTTON_UNBLOCK));
- activateButton.setEnabled(true);
- activateButton.setActionCommand(unblockCmd);
- } else if (status == STATUS.ACTIV) {
- activateButton.setText(getMessage(BUTTON_CHANGE));
- activateButton.setEnabled(true);
- activateButton.setActionCommand(changeCmd);
- } else if (status == STATUS.UNKNOWN) {
- activateButton.setText(getMessage(BUTTON_VERIFY));
- activateButton.setEnabled(true);
- activateButton.setActionCommand(verifyCmd);
- }
- }
- }
- });
- }
- });
-
- //select first entry
- pinStatusTable.getSelectionModel().setSelectionInterval(0, 0);
-
- JScrollPane pinStatusScrollPane = new JScrollPane(pinStatusTable);
-
- GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
- mainPanel.setLayout(mainPanelLayout);
-
- GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup()
- .addComponent(mgmtLabel);
- GroupLayout.Group messageVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(mgmtLabel);
- if (!renderHeaderPanel) {
- messageHorizontal
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
- .addComponent(helpLabel);
- messageVertical
- .addComponent(helpLabel);
- }
-
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(messageHorizontal)
- .addComponent(pinStatusScrollPane, 0, 0, Short.MAX_VALUE));
-
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createSequentialGroup()
- .addGroup(messageVertical)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(pinStatusScrollPane, 0, 0, pinStatusTable.getPreferredSize().height+3));
-
- JButton cancelButton = new JButton();
- cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD));
- cancelButton.setText(getMessage(BUTTON_CLOSE));
- cancelButton.setActionCommand(cancelCmd);
- cancelButton.addActionListener(cancelListener);
-
- GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
- buttonPanel.setLayout(buttonPanelLayout);
-
- GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup()
- .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(activateButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE);
-
- GroupLayout.Group buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(activateButton)
- .addComponent(cancelButton);
-
- buttonPanelLayout.setHorizontalGroup(buttonHorizontal);
- buttonPanelLayout.setVerticalGroup(buttonVertical);
-
- contentPanel.validate();
- }
- });
- }
-
- @Override
- public void showPINDialog(DIALOG type, PINSpec pinSpec,
- ActionListener okListener, String okCommand,
- ActionListener cancelListener, String cancelCommand) {
- showPINDialog(type, pinSpec, -1, false,
- okListener, okCommand, cancelListener, cancelCommand);
- }
-
- @Override
- public void showPINDialog(DIALOG type, PINSpec pinSpec, int retries,
- ActionListener okListener, String okCommand,
- ActionListener cancelListener, String cancelCommand) {
- showPINDialog(type, pinSpec, retries, false,
- okListener, okCommand, cancelListener, cancelCommand);
- }
-
- @Override
- public void showPinpadPINDialog(DIALOG type, PINSpec pinSpec, int retries) {
- String title, msg;
- Object[] params;
- if (retries < 0) {
- params = new Object[2];
- if (shortText) {
- params[0] = "PIN";
- } else {
- params[0] = pinSpec.getLocalizedName();
- }
- params[1] = pinSpec.getLocalizedLength();
- if (type == DIALOG.CHANGE) {
- log.debug("show change pin dialog");
- title = TITLE_CHANGE_PIN;
- msg = MESSAGE_CHANGEPIN_PINPAD;
- } else if (type == DIALOG.ACTIVATE) {
- log.debug("show activate pin dialog");
- title = TITLE_ACTIVATE_PIN;
- msg = MESSAGE_ENTERPIN_PINPAD;
- } else if (type == DIALOG.VERIFY) {
- log.debug("show verify pin dialog");
- title = TITLE_VERIFY_PIN;
- msg = MESSAGE_ENTERPIN_PINPAD;
- } else {
- log.debug("show unblock pin dialog");
- title = TITLE_UNBLOCK_PIN;
- msg = MESSAGE_ENTERPIN_PINPAD;
- }
-
- } else {
- log.debug("show retry pin dialog");
- title = TITLE_RETRY;
- msg = (retries < 2) ?
- MESSAGE_LAST_RETRY : MESSAGE_RETRIES;
- params = new Object[] {String.valueOf(retries)};
- }
- showMessageDialog(title, msg, params);
- }
-
- private void showPINDialog(final DIALOG type, final PINSpec pinSpec,
- final int retries, final boolean pinpad,
- final ActionListener okListener, final String okCommand,
- final ActionListener cancelListener, final String cancelCommand) {
-
- log.debug("scheduling pin dialog");
-
- SwingUtilities.invokeLater(new Runnable() {
-
- @Override
- public void run() {
-
- String HELP_TOPIC, TITLE, MESSAGE_MGMT, MESSAGE_MGMT_PARAM, PINSIZE;
- HELP_TOPIC = HELP_PINMGMT;
-
- PINSIZE = (pinSpec.getMaxLength() > pinSpec.getMinLength()) ?
- pinSpec.getMinLength() + "-" + pinSpec.getMaxLength() :
- String.valueOf(pinSpec.getMinLength());
-
- if (retries < 0) {
- if (type == DIALOG.CHANGE) {
- log.debug("show change pin dialog");
- TITLE = TITLE_CHANGE_PIN;
- MESSAGE_MGMT = MESSAGE_CHANGE_PIN;
- } else if (type == DIALOG.ACTIVATE) {
- log.debug("show activate pin dialog");
- TITLE = TITLE_ACTIVATE_PIN;
- MESSAGE_MGMT = MESSAGE_ACTIVATE_PIN;
- oldPinField = null;
- PINSIZE = pinSpec.getLocalizedLength();
- } else if (type == DIALOG.VERIFY) {
- log.debug("show verify pin dialog");
- TITLE = TITLE_VERIFY_PIN;
- MESSAGE_MGMT = MESSAGE_VERIFY_PIN;
- } else {
- log.debug("show unblock pin dialog");
- TITLE = TITLE_UNBLOCK_PIN;
- MESSAGE_MGMT = MESSAGE_UNBLOCK_PIN;
- }
- if (shortText) {
- MESSAGE_MGMT_PARAM = "PIN";
- } else {
- MESSAGE_MGMT_PARAM = pinSpec.getLocalizedName();
- }
- } else {
- log.debug("show retry pin dialog");
- TITLE = TITLE_RETRY;
- MESSAGE_MGMT = (retries < 2) ?
- MESSAGE_LAST_RETRY : MESSAGE_RETRIES;
- MESSAGE_MGMT_PARAM = String.valueOf(retries);
- }
-
- mainPanel.removeAll();
- buttonPanel.removeAll();
-
- helpListener.setHelpTopic(HELP_TOPIC);
-
- JLabel mgmtLabel = new JLabel();
- if (retries < 0) {
- mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD));
- } else {
- mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() | Font.BOLD));
- mgmtLabel.setForeground(ERROR_COLOR);
- helpListener.setHelpTopic(HELP_RETRY);
- }
-
- if (renderHeaderPanel) {
- titleLabel.setText(getMessage(TITLE));
- String mgmtPattern = getMessage(MESSAGE_MGMT);
- mgmtLabel.setText(MessageFormat.format(mgmtPattern, MESSAGE_MGMT_PARAM));
- } else {
- mgmtLabel.setText(getMessage(TITLE));
- }
-
- ////////////////////////////////////////////////////////////////
- // COMMON LAYOUT SECTION
- ////////////////////////////////////////////////////////////////
-
- GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
- mainPanel.setLayout(mainPanelLayout);
-
- GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup()
- .addComponent(mgmtLabel);
- GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(mgmtLabel);
-
- if (!renderHeaderPanel) {
- infoHorizontal
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
- .addComponent(helpLabel);
- infoVertical
- .addComponent(helpLabel);
- }
-
- GroupLayout.ParallelGroup pinHorizontal;
- GroupLayout.SequentialGroup pinVertical;
-
- if (pinpad) {
- JLabel pinpadLabel = new JLabel();
- pinpadLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD));
- String pinpadPattern = getMessage(MESSAGE_VERIFYPIN_PINPAD);
- pinpadLabel.setText(MessageFormat.format(pinpadPattern,
- new Object[] { pinSpec.getLocalizedName(), PINSIZE }));
-
- pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(pinpadLabel);
- pinVertical = mainPanelLayout.createSequentialGroup()
- .addComponent(pinpadLabel);
- } else {
-
- JButton okButton = new JButton();
- okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~Font.BOLD));
- okButton.setText(getMessage(BUTTON_OK));
- okButton.setEnabled(pinSpec.getMinLength() <= 0);
- okButton.setActionCommand(okCommand);
- okButton.addActionListener(okListener);
-
- JLabel oldPinLabel = null;
- JLabel repeatPinLabel = null;
- JLabel pinLabel = new JLabel();
- pinLabel.setFont(pinLabel.getFont().deriveFont(pinLabel.getFont().getStyle() & ~Font.BOLD));
- String pinLabelPattern = (type == DIALOG.CHANGE) ? getMessage(LABEL_NEW_PIN) : getMessage(LABEL_PIN);
- pinLabel.setText(MessageFormat.format(pinLabelPattern, new Object[]{pinSpec.getLocalizedName()}));
-
- final JPasswordField repeatPinField = new JPasswordField();
- pinField = new JPasswordField();
- pinField.setText("");
- pinField.setActionCommand(okCommand);
- pinField.addActionListener(new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- if (pinField.getPassword().length >= pinSpec.getMinLength()) {
- if (type == DIALOG.VERIFY) {
- okListener.actionPerformed(e);
- } else {
- repeatPinField.requestFocusInWindow();
- }
- }
- }
- });
-
- if (type != DIALOG.VERIFY) {
- pinField.setDocument(new PINDocument(pinSpec, null));
- repeatPinLabel = new JLabel();
- repeatPinLabel.setFont(pinLabel.getFont());
- String repeatPinLabelPattern = getMessage(LABEL_REPEAT_PIN);
- repeatPinLabel.setText(MessageFormat.format(repeatPinLabelPattern, new Object[]{pinSpec.getLocalizedName()}));
-
- repeatPinField.setText("");
-// repeatPinField.setDocument(new PINDocument(pinSpec, okButton, pinField.getDocument()));
- repeatPinField.setActionCommand(okCommand);
- repeatPinField.addActionListener(new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- if (pinField.getPassword().length >= pinSpec.getMinLength()) {
- okListener.actionPerformed(e);
- }
- }
- });
-
- if (type == DIALOG.CHANGE) {
- oldPinLabel = new JLabel();
- oldPinLabel.setFont(oldPinLabel.getFont().deriveFont(oldPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- String oldPinLabelPattern = getMessage(LABEL_OLD_PIN);
- oldPinLabel.setText(MessageFormat.format(oldPinLabelPattern, new Object[]{pinSpec.getLocalizedName()}));
-
- oldPinField = new JPasswordField();
- oldPinField.setText("");
- oldPinField.setDocument(new PINDocument(pinSpec, null));
- oldPinField.setActionCommand(okCommand);
- oldPinField.addActionListener(new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- if (oldPinField.getPassword().length >= pinSpec.getMinLength()) {
- pinField.requestFocusInWindow();
- }
- }
- });
-
- repeatPinField.setDocument(new PINDocument(
- pinSpec, okButton,
- pinField.getDocument(), oldPinField.getDocument()));
- } else {
- // else -> ACTIVATE (not verify, not change)
- repeatPinField.setDocument(new PINDocument(
- pinSpec, okButton, pinField.getDocument()));
- }
- } else {
- pinField.setDocument(new PINDocument(pinSpec, okButton));
- }
-
- JLabel pinsizeLabel = new JLabel();
- pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~Font.BOLD, pinsizeLabel.getFont().getSize()-2));
- String pinsizePattern = getMessage(LABEL_PINSIZE);
- pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{PINSIZE}));
-
- ////////////////////////////////////////////////////////////////
- // NON-PINPAD SPECIFIC LAYOUT SECTION
- ////////////////////////////////////////////////////////////////
-
- pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
- pinVertical = mainPanelLayout.createSequentialGroup();
-
-// if (pinLabelPos == PinLabelPosition.ABOVE) {
-// if (changePin) {
-// pinHorizontal
-// .addComponent(oldPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-// .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE);
-// pinVertical
-// .addComponent(oldPinLabel)
-// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
-// .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
-// }
-// pinHorizontal
-// .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-// .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-// .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-// .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-// .addGroup(mainPanelLayout.createSequentialGroup()
-// .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
-// .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE));
-// pinVertical
-// .addComponent(pinLabel)
-// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
-// .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
-// .addComponent(repeatPinLabel)
-// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
-// .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
-// .addComponent(pinsizeLabel);
-// } else {
-
-
- if (type == DIALOG.CHANGE) {
- pinHorizontal
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(oldPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
-
- pinVertical
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(oldPinLabel)
- .addComponent(oldPinField))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(pinLabel)
- .addComponent(pinField))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(repeatPinLabel)
- .addComponent(repeatPinField))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
- } else if (type == DIALOG.ACTIVATE) {
- pinHorizontal
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
-
- pinVertical
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(pinLabel)
- .addComponent(pinField))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(repeatPinLabel)
- .addComponent(repeatPinField))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
- } else { // VERIFY
- pinHorizontal
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
-
- pinVertical
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(pinLabel)
- .addComponent(pinField))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
- }
- pinHorizontal
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
- .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE));
- pinVertical
- .addComponent(pinsizeLabel);
-
- GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
- buttonPanel.setLayout(buttonPanelLayout);
-
- GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup()
- .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE);
- GroupLayout.Group buttonVertical;
-
- JButton cancelButton = new JButton();
- cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD));
- cancelButton.setText(getMessage(BUTTON_CANCEL));
- cancelButton.setActionCommand(cancelCommand);
- cancelButton.addActionListener(cancelListener);
-
- buttonHorizontal
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE);
- buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(okButton)
- .addComponent(cancelButton);
-
- buttonPanelLayout.setHorizontalGroup(buttonHorizontal);
- buttonPanelLayout.setVerticalGroup(buttonVertical);
-
- if (oldPinField != null) {
- oldPinField.requestFocusInWindow();
- } else {
- pinField.requestFocusInWindow();
- }
-
- } // END NON-PINPAD SECTION
-
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(infoHorizontal)
- .addGroup(pinHorizontal));
-
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createSequentialGroup()
- .addGroup(infoVertical)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(pinVertical));
-
- contentPanel.validate();
-
- }
- });
- }
-
- @Override
- protected int initButtonSize() {
- int bs = super.initButtonSize();
-
- JButton b = new JButton();
- b.setText(getMessage(BUTTON_ACTIVATE));
- if (b.getPreferredSize().width > bs) {
- bs = b.getPreferredSize().width;
- }
- b.setText(getMessage(BUTTON_CHANGE));
- if (b.getPreferredSize().width > bs) {
- bs = b.getPreferredSize().width;
- }
- b.setText(getMessage(BUTTON_UNBLOCK));
- if (b.getPreferredSize().width > bs) {
- bs = b.getPreferredSize().width;
- }
- b.setText(getMessage(BUTTON_CANCEL));
- if (b.getPreferredSize().width > bs) {
- bs = b.getPreferredSize().width;
- }
-
- return bs;
- }
-
-}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java
deleted file mode 100644
index f99bcfd1..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2008 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package at.gv.egiz.bku.gui;
-
-import at.gv.egiz.smcc.PINSpec;
-import java.awt.event.ActionListener;
-import java.util.Map;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public interface PINManagementGUIFacade extends BKUGUIFacade {
-
- public static final String HELP_PINMGMT = "help.pin.mgmt";
-// public static final String HELP_VERIFY_PIN = "help.pin.verify";
- public static final String TITLE_PINMGMT = "title.pin.mgmt";
- public static final String TITLE_ACTIVATE_PIN = "title.activate.pin";
- public static final String TITLE_CHANGE_PIN = "title.change.pin";
- public static final String TITLE_VERIFY_PIN = "title.verify.pin";
- public static final String TITLE_UNBLOCK_PIN = "title.unblock.pin";
- public static final String TITLE_ACTIVATE_SUCCESS = "title.activate.success";
- public static final String TITLE_CHANGE_SUCCESS = "title.change.success";
-
- // removed message.* prefix to reuse keys as help keys
- public static final String MESSAGE_ACTIVATE_SUCCESS = "activate.success";
- public static final String MESSAGE_CHANGE_SUCCESS = "change.success";
- public static final String MESSAGE_PINMGMT = "pin.mgmt";
-// public static final String MESSAGE_PINPAD = "pinpad";
- public static final String MESSAGE_ACTIVATE_PIN = "activate.pin";
- public static final String MESSAGE_CHANGE_PIN = "change.pin";
- public static final String MESSAGE_VERIFY_PIN = "verify.pin";
- public static final String MESSAGE_UNBLOCK_PIN = "unblock.pin";
- public static final String MESSAGE_ACTIVATEPIN_PINPAD = "activate.pinpad";
- public static final String MESSAGE_CHANGEPIN_PINPAD = "change.pinpad";
- public static final String MESSAGE_VERIFYPIN_PINPAD = "verify.pinpad";
- public static final String MESSAGE_UNBLOCKPIN_PINPAD = "unblock.pinpad";
-
- public static final String LABEL_OLD_PIN = "label.old.pin";
- public static final String LABEL_NEW_PIN = "label.new.pin";
- public static final String LABEL_REPEAT_PIN = "label.repeat.pin";
-
- public static final String ERR_STATUS = "err.status";
- public static final String ERR_ACTIVATE = "err.activate";
- public static final String ERR_CHANGE = "err.change";
- public static final String ERR_UNBLOCK = "err.unblock";
- public static final String ERR_VERIFY = "err.verify";
- public static final String ERR_RETRIES = "err.retries";
- public static final String ERR_LOCKED = "err.locked";
- public static final String ERR_NOT_ACTIVE = "err.not.active";
- public static final String ERR_PIN_FORMAT = "err.pin.format";
- public static final String ERR_PIN_CONFIRMATION = "err.pin.confirmation";
- public static final String ERR_PIN_OPERATION_ABORTED = "err.pin.operation.aborted";
- public static final String ERR_UNSUPPORTED_CARD = "err.unsupported.card";
-
- public static final String BUTTON_ACTIVATE = "button.activate";
- public static final String BUTTON_UNBLOCK = "button.unblock";
- public static final String BUTTON_CHANGE = "button.change";
- public static final String BUTTON_VERIFY = "button.verify";
-
- public static final String STATUS_ACTIVE = "status.active";
- public static final String STATUS_BLOCKED = "status.blocked";
- public static final String STATUS_NOT_ACTIVE = "status.not.active";
- public static final String STATUS_UNKNOWN = "status.unknown";
-
- public enum STATUS { ACTIV, NOT_ACTIV, BLOCKED, UNKNOWN };
- public enum DIALOG { VERIFY, ACTIVATE, CHANGE, UNBLOCK };
-
- public void showPINManagementDialog(Map pins,
- ActionListener activateListener, String activateCmd, String changeCmd, String unblockCmd, String verifyCmd,
- ActionListener cancelListener, String cancelCmd);
-
- public void showPINDialog(DIALOG type, PINSpec pin,
- ActionListener okListener, String okCmd,
- ActionListener cancelListener, String cancelCmd);
-
- public void showPINDialog(DIALOG type, PINSpec pin, int retries,
- ActionListener okListener, String okCmd,
- ActionListener cancelListener, String cancelCmd);
-
- public void showPinpadPINDialog(DIALOG type, PINSpec pin, int retries);
-
-// public void showActivatePINDialog(PINSpec pin,
-// ActionListener okListener, String okCmd,
-// ActionListener cancelListener, String cancelCmd);
-//
-// public void showChangePINDialog(PINSpec pin,
-// ActionListener okListener, String okCmd,
-// ActionListener cancelListener, String cancelCmd);
-//
-// public void showUnblockPINDialog(PINSpec pin,
-// ActionListener okListener, String okCmd,
-// ActionListener cancelListener, String cancelCmd);
-//
-// public void showVerifyPINDialog(PINSpec pin,
-// ActionListener okListener, String okCmd,
-// ActionListener cancelListener, String cancelCmd);
-
- public char[] getOldPin();
-
- public PINSpec getSelectedPINSpec();
-}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java
deleted file mode 100644
index e3d73e1f..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright 2008 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package at.gv.egiz.bku.gui;
-
-import at.gv.egiz.smcc.PINSpec;
-import javax.swing.table.DefaultTableCellRenderer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class PINSpecRenderer extends DefaultTableCellRenderer {
-
- private static final Log log = LogFactory.getLog(PINSpecRenderer.class);
-
- @Override
- protected void setValue(Object value) {
- PINSpec pinSpec = (PINSpec) value;
- super.setText(pinSpec.getLocalizedName());
- }
-
-}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java
deleted file mode 100644
index 83ff74f2..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2008 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package at.gv.egiz.bku.gui;
-
-import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS;
-import java.awt.Color;
-import java.awt.Font;
-import java.util.ResourceBundle;
-import javax.swing.table.DefaultTableCellRenderer;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class PINStatusRenderer extends DefaultTableCellRenderer {
-
-// private static final Log log = LogFactory.getLog(PINStatusRenderer.class);
-
- public static final Color RED = new Color(0.9f, 0.0f, 0.0f);
- public static final Color GREEN = new Color(0.0f, 0.8f, 0.0f);
- protected ResourceBundle messages;
-
- public PINStatusRenderer(ResourceBundle messages) {
- this.messages = messages;
- }
-
- @Override
- protected void setValue(Object value) {
- STATUS pinStatus = (STATUS) value;
- super.setFont(super.getFont().deriveFont(super.getFont().getStyle() | Font.BOLD));
-
- if (pinStatus == STATUS.NOT_ACTIV) {
- super.setForeground(RED);
- super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_NOT_ACTIVE) + "");
- } else if (pinStatus == STATUS.ACTIV) {
- super.setForeground(GREEN);
- super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_ACTIVE) + "");
- } else if (pinStatus == STATUS.BLOCKED) {
- super.setForeground(RED);
- super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_BLOCKED) + "");
- } else {
- super.setForeground(Color.BLACK);
- super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_UNKNOWN) + "");
- }
- }
-}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java
deleted file mode 100644
index 052c13b2..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright 2008 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package at.gv.egiz.bku.gui;
-
-import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS;
-import at.gv.egiz.smcc.PINSpec;
-import java.util.Map;
-import javax.swing.table.DefaultTableModel;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class PINStatusTableModel extends DefaultTableModel {
-
-// protected static final Log log = LogFactory.getLog(PINStatusTableModel.class);
- protected Class[] types;
-
- public PINStatusTableModel(Map pinStatuses) {
- super(0, 2);
- if (pinStatuses == null) {
- throw new RuntimeException("pinStatuses must not be null");
- }
-// log.trace(pinStatuses.size() + " PINs");
- types = new Class[] { PINSpec.class, STATUS.class };
- for (PINSpec pinSpec : pinStatuses.keySet()) {
- addRow(new Object[] { pinSpec, pinStatuses.get(pinSpec) });
- }
-// PINSpec activePIN = new PINSpec(0, 1, null, "active-PIN", (byte) 0x01);
-// PINSpec blockedPIN = new PINSpec(0, 1, null, "blocked-PIN", (byte) 0x01);
-// addRow(new Object[] { activePIN, PINStatusProvider.STATUS.ACTIV });
-// addRow(new Object[] { blockedPIN, PINStatusProvider.STATUS.BLOCKED });
- }
-
- @Override
- public Class getColumnClass(int columnIndex) {
- return types[columnIndex];
- }
-
- @Override
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return false;
- }
-}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java
index 68f0cb72..cfd1e200 100644
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java
@@ -22,7 +22,7 @@ import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.gui.BKUGUIFacade.Style;
import at.gv.egiz.bku.online.applet.BKUApplet;
import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL;
-import at.gv.egiz.bku.smccstal.ext.CardMgmtRequestHandler;
+import at.gv.egiz.bku.smccstal.CardMgmtRequestHandler;
import at.gv.egiz.stal.ext.APDUScriptRequest;
import at.gv.egiz.stal.service.STALPortType;
import at.gv.egiz.stal.service.translator.STALTranslator;
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java
index 81b635f8..d06c2865 100644
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java
@@ -18,11 +18,16 @@ package at.gv.egiz.bku.online.applet;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.gui.PINManagementGUIFacade;
-import at.gv.egiz.bku.smccstal.ext.PINManagementRequestHandler;
+import at.gv.egiz.bku.smccstal.PINManagementRequestHandler;
import at.gv.egiz.stal.ErrorResponse;
+import at.gv.egiz.stal.InfoboxReadRequest;
+import at.gv.egiz.stal.QuitRequest;
+import at.gv.egiz.stal.STALRequest;
import at.gv.egiz.stal.STALResponse;
+import at.gv.egiz.stal.SignRequest;
import at.gv.egiz.stal.ext.PINManagementRequest;
import at.gv.egiz.stal.ext.PINManagementResponse;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -36,7 +41,8 @@ public class PINManagementBKUWorker extends AppletBKUWorker {
public PINManagementBKUWorker(BKUApplet applet, PINManagementGUIFacade gui) {
super(applet, gui);
- handlerMap.clear();
+ removeRequestHandler(InfoboxReadRequest.class);
+ removeRequestHandler(SignRequest.class);
addRequestHandler(PINManagementRequest.class, new PINManagementRequestHandler());
}
@@ -46,7 +52,11 @@ public class PINManagementBKUWorker extends AppletBKUWorker {
BKUGUIFacade.MESSAGE_WELCOME);
try {
- List responses = handleRequest(Collections.singletonList(new PINManagementRequest()));
+
+ ArrayList reqs = new ArrayList();
+ reqs.add(new PINManagementRequest());
+ reqs.add(new QuitRequest());
+ List responses = handleRequest(reqs);
if (responses.size() == 1) {
STALResponse response = responses.get(0);
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java
deleted file mode 100644
index 769342e7..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
-* Copyright 2008 Federal Chancellery Austria and
-* Graz University of Technology
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/**
- *
- */
-package at.gv.egiz.bku.smccstal.ext;
-
-import at.gv.egiz.bku.gui.ActivationGUIFacade;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.smartcardio.Card;
-import javax.smartcardio.CardChannel;
-import javax.smartcardio.CardException;
-import javax.smartcardio.CommandAPDU;
-import javax.smartcardio.ResponseAPDU;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.smccstal.AbstractRequestHandler;
-import at.gv.egiz.smcc.SignatureCardException;
-import at.gv.egiz.stal.ErrorResponse;
-import at.gv.egiz.stal.STALRequest;
-import at.gv.egiz.stal.STALResponse;
-import at.gv.egiz.stal.ext.APDUScriptRequest;
-import at.gv.egiz.stal.ext.APDUScriptResponse;
-import at.gv.egiz.stal.ext.APDUScriptRequest.Command;
-import at.gv.egiz.stal.ext.APDUScriptRequest.RequestScriptElement;
-import at.gv.egiz.stal.ext.APDUScriptRequest.Reset;
-import at.gv.egiz.stal.ext.APDUScriptResponse.Response;
-import at.gv.egiz.stal.ext.APDUScriptResponse.ATR;
-import at.gv.egiz.stal.ext.APDUScriptResponse.ResponseScriptElement;
-import java.awt.event.ActionListener;
-
-/**
- * @author mcentner
- *
- */
-public class CardMgmtRequestHandler extends AbstractRequestHandler implements ActionListener {
-
- /**
- * Logging facility.
- */
- private static Log log = LogFactory.getLog(CardMgmtRequestHandler.class);
-
- /**
- * The sequence counter.
- */
- private int sequenceNum = 0;
-
- /**
- * display script num
- */
- private int currentActivationScript = 0;
-
- @Override
- public STALResponse handleRequest(STALRequest request)
- throws InterruptedException {
-
- // APDU Script Request
- if (request instanceof APDUScriptRequest) {
-
- currentActivationScript++;
- log.debug("handling APDU script " + currentActivationScript);
-
- Card icc = card.getCard();
-
- if (icc == null) {
- log.error("SignatureCard instance '" + card.getClass().getName() + "' does not support card management requests.");
- return new ErrorResponse(1000);
- }
-
- List script = ((APDUScriptRequest) request).getScript();
- ArrayList responses = new ArrayList(script.size());
-
- ((ActivationGUIFacade) gui).showActivationProgressDialog(currentActivationScript, script.size(), this, "cancel");
-
- try {
- log.trace("begin exclusive");
- icc.beginExclusive();
-
- for (RequestScriptElement scriptElement : script) {
- ((ActivationGUIFacade) gui).incrementProgress();
-
- if (scriptElement instanceof Command) {
- log.trace("handling APDU script element COMMAND");
- Command command = (Command) scriptElement;
- CommandAPDU commandAPDU = new CommandAPDU(command.getCommandAPDU());
-
- log.trace("get basicchannel");
- CardChannel channel = icc.getBasicChannel();
-
- sequenceNum = command.getSequence();
- log.debug("Transmit APDU (sequence=" + sequenceNum + ")");
- log.trace(commandAPDU.toString());
- ResponseAPDU responseAPDU = channel.transmit(commandAPDU);
- log.trace(responseAPDU.toString());
-
- byte[] sw = new byte[] {
- (byte) (0xFF & responseAPDU.getSW1()),
- (byte) (0xFF & responseAPDU.getSW2()) };
-
- responses.add(new Response(sequenceNum, responseAPDU.getData(), sw, 0));
-
- if (command.getExpectedSW() != null &&
- !Arrays.equals(sw, command.getExpectedSW())) {
- // unexpected SW
- log.warn("Got unexpected SW. APDU-script execution stopped.");
- break;
- }
-
- } else if (scriptElement instanceof Reset) {
-
- log.trace("handling APDU script element RESET");
- sequenceNum = 0;
- card.reset();
- javax.smartcardio.ATR atr = icc.getATR();
- log.trace("got ATR: " + atr.toString());
- responses.add(new ATR(atr.getBytes()));
-
- log.trace("regain exclusive access to card");
- icc = card.getCard();
- icc.beginExclusive();
- }
-
- }
-
- } catch (CardException e) {
- log.info("Failed to execute APDU script.", e);
- responses.add(new Response(sequenceNum, null, null, Response.RC_UNSPECIFIED));
- } catch (SignatureCardException e) {
- log.info("Failed to reset smart card.", e);
- responses.add(new Response(sequenceNum, null, null, Response.RC_UNSPECIFIED));
- } catch (RuntimeException e) {
- log.error(e);
- throw e;
- } finally {
- try {
- icc.endExclusive();
- } catch (CardException e) {
- log.info(e);
- }
- }
-
- log.trace("done handling APDU script " + currentActivationScript + ", return response containing " + responses.size() + " elements");
- ((ActivationGUIFacade) gui).showIdleDialog(this, "cancel");
- return new APDUScriptResponse(responses);
-
- } else {
- log.error("Got unexpected STAL request: " + request);
- return new ErrorResponse(1000);
- }
-
- }
-
- @Override
- public boolean requireCard() {
- return true;
- }
-
-}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java
deleted file mode 100644
index abbe66a1..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2008 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package at.gv.egiz.bku.smccstal.ext;
-
-import at.gv.egiz.smcc.SignatureCardException;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class GetPINStatusException extends SignatureCardException {
-
- /**
- * Creates a new instance of GetStatusException
without detail message.
- */
- public GetPINStatusException() {
- }
-
-
- /**
- * Constructs an instance of GetStatusException
with the specified detail message.
- * @param msg the detail message.
- */
- public GetPINStatusException(String msg) {
- super(msg);
- }
-}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java
deleted file mode 100644
index f54f89d4..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright 2008 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package at.gv.egiz.bku.smccstal.ext;
-
-import at.gv.egiz.bku.gui.BKUGUIFacade;
-import at.gv.egiz.smcc.ChangePINProvider;
-import at.gv.egiz.bku.gui.PINManagementGUIFacade;
-import at.gv.egiz.bku.smccstal.AbstractPINProvider;
-import at.gv.egiz.bku.smccstal.PINProviderFactory;
-import at.gv.egiz.smcc.CancelledException;
-import at.gv.egiz.smcc.ccid.CCID;
-import at.gv.egiz.smcc.PINProvider;
-import at.gv.egiz.smcc.PINSpec;
-import at.gv.egiz.smcc.SignatureCard;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class ManagementPINProviderFactory extends PINProviderFactory {
-
- public ManagementPINProviderFactory(CCID reader, PINManagementGUIFacade gui) {
- super(reader, gui);
- }
-
-// public static ManagementPINProviderFactory getInstance(SignatureCard forCard,
-// PINManagementGUIFacade gui) {
-// if (forCard.getReader().hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) {
-// return new PinpadPINProviderFactory(gui);
-//
-// } else {
-// return new SoftwarePINProviderFactory(gui);
-// }
-// }
-
- public PINProvider getVerifyPINProvider() {
- if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_START)) {
- return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.VERIFY);
- } else if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) {
- return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.VERIFY);
- } else {
- return new SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG.VERIFY);
- }
- }
-
- public PINProvider getActivatePINProvider() {
- if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_START)) {
- return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.ACTIVATE);
- } else if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_DIRECT)) {
- return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.ACTIVATE);
- } else {
- return new SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG.ACTIVATE);
- }
- }
-
- public ChangePINProvider getChangePINProvider() {
- if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_START)) {
- return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.CHANGE);
- } else if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_DIRECT)) {
- return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.CHANGE);
- } else {
- return new ChangePinProvider();
- }
- }
-
- public PINProvider getUnblockPINProvider() {
- if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_START)) {
- return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.UNBLOCK);
- } else if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) {
- return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.UNBLOCK);
- } else {
- return new SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG.UNBLOCK);
- }
- }
-
- class PinpadGenericPinProvider extends AbstractPINProvider
- implements ChangePINProvider {
-
- protected PINManagementGUIFacade.DIALOG type;
-
- private PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG type) {
- this.type = type;
- }
-
- @Override
- public char[] providePIN(PINSpec spec, int retries)
- throws CancelledException, InterruptedException {
-
- showPinpadPINDialog(retries, spec);
- retry = true;
- return null;
- }
-
- /**
- * do not call this method without calling providePIN()
- * (no message is displayed)
- * @param spec
- * @param retries
- * @return
- */
- @Override
- public char[] provideOldPIN(PINSpec spec, int retries) {
- return null;
- }
-
- private void showPinpadPINDialog(int retries, PINSpec pinSpec) {
- String title, message;
- Object[] params;
- if (retry) {
- if (retries == 1) {
- message = BKUGUIFacade.MESSAGE_LAST_RETRY_PINPAD;
- } else {
- message = BKUGUIFacade.MESSAGE_RETRIES_PINPAD;
- }
- title = BKUGUIFacade.TITLE_RETRY;
- params = new Object[]{String.valueOf(retries)};
- } else if (type == PINManagementGUIFacade.DIALOG.VERIFY) {
- title = PINManagementGUIFacade.TITLE_VERIFY_PIN;
- message = BKUGUIFacade.MESSAGE_ENTERPIN_PINPAD;
- String pinSize = String.valueOf(pinSpec.getMinLength());
- if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
- pinSize += "-" + pinSpec.getMaxLength();
- }
- params = new Object[]{pinSpec.getLocalizedName(), pinSize};
- } else if (type == PINManagementGUIFacade.DIALOG.ACTIVATE) {
- title = PINManagementGUIFacade.TITLE_ACTIVATE_PIN;
- message = PINManagementGUIFacade.MESSAGE_ACTIVATEPIN_PINPAD;
- String pinSize = String.valueOf(pinSpec.getMinLength());
- if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
- pinSize += "-" + pinSpec.getMaxLength();
- }
- params = new Object[]{pinSpec.getLocalizedName(), pinSize};
- } else if (type == PINManagementGUIFacade.DIALOG.CHANGE) {
- title = PINManagementGUIFacade.TITLE_CHANGE_PIN;
- message = PINManagementGUIFacade.MESSAGE_CHANGEPIN_PINPAD;
- String pinSize = String.valueOf(pinSpec.getMinLength());
- if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
- pinSize += "-" + pinSpec.getMaxLength();
- }
- params = new Object[]{pinSpec.getLocalizedName(), pinSize};
- } else { //if (type == DIALOG.UNBLOCK) {
- title = PINManagementGUIFacade.TITLE_UNBLOCK_PIN;
- message = PINManagementGUIFacade.MESSAGE_UNBLOCKPIN_PINPAD;
- String pinSize = String.valueOf(pinSpec.getMinLength());
- if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
- pinSize += "-" + pinSpec.getMaxLength();
- }
- params = new Object[]{pinSpec.getLocalizedName(), pinSize};
- }
- gui.showMessageDialog(title, message, params);
- }
- }
-
-
- class SoftwareGenericPinProvider extends AbstractPINProvider {
-
-// protected PINManagementGUIFacade gui;
- protected PINManagementGUIFacade.DIALOG type;
-
- private SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG type) {
- this.type = type;
- }
-
- @Override
- public char[] providePIN(PINSpec spec, int retries)
- throws CancelledException, InterruptedException {
-
- ((PINManagementGUIFacade) gui).showPINDialog(type, spec,
- (retry) ? retries : -1,
- this, "exec",
- this, "back");
-
- waitForAction();
-
- if ("exec".equals(action)) {
- gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
- BKUGUIFacade.MESSAGE_WAIT);
- retry = true;
- return gui.getPin();
- } else if ("back".equals(action)) {
- throw new CancelledException();
- } else {
- log.error("unsupported command " + action);
- throw new CancelledException();
- }
- }
- }
-
- class ChangePinProvider extends AbstractPINProvider
- implements ChangePINProvider {
-
-// protected PINManagementGUIFacade gui;
-
- private char[] oldPin;
- private char[] newPin;
-
- private ChangePinProvider() {
- }
-
- @Override
- public char[] providePIN(PINSpec spec, int retries)
- throws CancelledException, InterruptedException {
- if (newPin == null) {
- getPINs(spec, retries);
- }
- char[] pin = newPin;
- newPin = null;
- return pin;
- }
-
- @Override
- public char[] provideOldPIN(PINSpec spec, int retries)
- throws CancelledException, InterruptedException {
- if (oldPin == null) {
- getPINs(spec, retries);
- }
- char[] pin = oldPin;
- oldPin = null;
- return pin;
- }
-
- private void getPINs(PINSpec spec, int retries)
- throws InterruptedException, CancelledException {
-
- ((PINManagementGUIFacade) gui).showPINDialog(
- PINManagementGUIFacade.DIALOG.CHANGE, spec,
- (retry) ? retries : -1,
- this, "exec",
- this, "back");
-
- waitForAction();
-
- if ("exec".equals(action)) {
- gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
- BKUGUIFacade.MESSAGE_WAIT);
- retry = true;
- oldPin = ((PINManagementGUIFacade) gui).getOldPin();
- newPin = gui.getPin();
- } else if ("back".equals(action)) {
- throw new CancelledException();
- } else {
- log.error("unsupported command " + action);
- throw new CancelledException();
- }
- }
- }
-}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java
deleted file mode 100644
index e0b09d63..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright 2008 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package at.gv.egiz.bku.smccstal.ext;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.gui.BKUGUIFacade;
-import at.gv.egiz.bku.gui.PINManagementGUIFacade;
-import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS;
-import at.gv.egiz.bku.smccstal.AbstractRequestHandler;
-import at.gv.egiz.smcc.CancelledException;
-import at.gv.egiz.smcc.LockedException;
-import at.gv.egiz.smcc.NotActivatedException;
-import at.gv.egiz.smcc.PINConfirmationException;
-import at.gv.egiz.smcc.PINFormatException;
-import at.gv.egiz.smcc.PINMgmtSignatureCard;
-import at.gv.egiz.smcc.PINOperationAbortedException;
-import at.gv.egiz.smcc.PINSpec;
-import at.gv.egiz.smcc.SignatureCardException;
-import at.gv.egiz.smcc.TimeoutException;
-import at.gv.egiz.smcc.PINMgmtSignatureCard.PIN_STATE;
-import at.gv.egiz.stal.ErrorResponse;
-import at.gv.egiz.stal.STALRequest;
-import at.gv.egiz.stal.STALResponse;
-import at.gv.egiz.stal.ext.PINManagementRequest;
-import at.gv.egiz.stal.ext.PINManagementResponse;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class PINManagementRequestHandler extends AbstractRequestHandler {
-
- protected static final Log log = LogFactory.getLog(PINManagementRequestHandler.class);
-
- protected Map pinStates = new HashMap();
-
- @Override
- public STALResponse handleRequest(STALRequest request) throws InterruptedException {
- if (request instanceof PINManagementRequest) {
-
- PINManagementGUIFacade gui = (PINManagementGUIFacade) this.gui;
-
- PINSpec selectedPIN = null;
-
- try {
-
- if (card instanceof PINMgmtSignatureCard) {
-
- // update all PIN states
- for (PINSpec pinSpec : ((PINMgmtSignatureCard) card).getPINSpecs()) {
- updatePINState(pinSpec, STATUS.UNKNOWN);
- }
-
- gui.showPINManagementDialog(pinStates, this, "activate_enterpin",
- "change_enterpin", "unblock_enterpuk", "verify_enterpin", this,
- "cancel");
-
- } else {
-
- // card does not support PIN management
- gui.showErrorDialog(PINManagementGUIFacade.ERR_UNSUPPORTED_CARD,
- null, this, "cancel");
-
- }
-
- while (true) {
-
- waitForAction();
-
- if ("cancel".equals(actionCommand)) {
- return new PINManagementResponse();
- } else {
- selectedPIN = gui.getSelectedPINSpec();
-
- if (selectedPIN == null) {
- throw new NullPointerException("no PIN selected for activation/change");
- }
-
- ManagementPINProviderFactory ppfac =
- new ManagementPINProviderFactory(card.getReader(), gui);
-
- try {
- if ("activate_enterpin".equals(actionCommand)) {
- log.info("activate " + selectedPIN.getLocalizedName());
- ((PINMgmtSignatureCard) card).activatePIN(selectedPIN,
- ppfac.getActivatePINProvider());
- updatePINState(selectedPIN, STATUS.ACTIV);
- gui.showMessageDialog(PINManagementGUIFacade.TITLE_ACTIVATE_SUCCESS,
- PINManagementGUIFacade.MESSAGE_ACTIVATE_SUCCESS,
- new Object[] {selectedPIN.getLocalizedName()},
- BKUGUIFacade.BUTTON_OK, this, "ok");
- waitForAction();
- } else if ("change_enterpin".equals(actionCommand)) {
- log.info("change " + selectedPIN.getLocalizedName());
- ((PINMgmtSignatureCard) card).changePIN(selectedPIN,
- ppfac.getChangePINProvider());
- updatePINState(selectedPIN, STATUS.ACTIV);
- gui.showMessageDialog(PINManagementGUIFacade.TITLE_CHANGE_SUCCESS,
- PINManagementGUIFacade.MESSAGE_CHANGE_SUCCESS,
- new Object[] {selectedPIN.getLocalizedName()},
- BKUGUIFacade.BUTTON_OK, this, "ok");
- waitForAction();
-
- } else if ("unblock_enterpuk".equals(actionCommand)) {
- log.info("unblock " + selectedPIN.getLocalizedName());
- ((PINMgmtSignatureCard) card).unblockPIN(selectedPIN,
- ppfac.getUnblockPINProvider());
- } else if ("verify_enterpin".equals(actionCommand)) {
- log.info("verify " + selectedPIN.getLocalizedName());
- ((PINMgmtSignatureCard) card).verifyPIN(selectedPIN,
- ppfac.getVerifyPINProvider());
- updatePINState(selectedPIN, STATUS.ACTIV);
- }
- } catch (CancelledException ex) {
- log.trace("cancelled");
- } catch (TimeoutException ex) {
- log.error("Timeout during pin entry");
- gui.showMessageDialog(BKUGUIFacade.TITLE_ENTRY_TIMEOUT,
- BKUGUIFacade.ERR_PIN_TIMEOUT,
- new Object[] {selectedPIN.getLocalizedName()},
- BKUGUIFacade.BUTTON_OK, this, null);
- waitForAction();
- } catch (LockedException ex) {
- log.error(selectedPIN.getLocalizedName() + " locked");
- updatePINState(selectedPIN, STATUS.BLOCKED);
- gui.showErrorDialog(PINManagementGUIFacade.ERR_LOCKED,
- new Object[] {selectedPIN.getLocalizedName()},
- this, null);
- waitForAction();
- } catch (NotActivatedException ex) {
- log.error(selectedPIN.getLocalizedName() + " not active");
- updatePINState(selectedPIN, STATUS.NOT_ACTIV);
- gui.showErrorDialog(PINManagementGUIFacade.ERR_NOT_ACTIVE,
- new Object[] {selectedPIN.getLocalizedName()},
- this, null);
- waitForAction();
- } catch (PINConfirmationException ex) {
- log.error("confirmation pin does not match new " + selectedPIN.getLocalizedName());
- gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_CONFIRMATION,
- new Object[] {selectedPIN.getLocalizedName()},
- this, null);
- waitForAction();
- } catch (PINOperationAbortedException ex) {
- log.error("pin operation aborted without further details");
- gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_OPERATION_ABORTED,
- new Object[] {selectedPIN.getLocalizedName()},
- this, null);
- waitForAction();
- } catch (PINFormatException ex) {
- log.error("wrong format of new " + selectedPIN.getLocalizedName());
-// updatePINStatus(selectedPIN, STATUS.NOT_ACTIV);
- String pinSize = String.valueOf(selectedPIN.getMinLength());
- if (selectedPIN.getMinLength() != selectedPIN.getMaxLength()) {
- pinSize += "-" + selectedPIN.getMaxLength();
- }
- gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_FORMAT,
- new Object[] {selectedPIN.getLocalizedName(), pinSize},
- this, null);
- waitForAction();
- }
- } // end if
-
- selectedPIN = null;
- gui.showPINManagementDialog(pinStates,
- this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin",
- this, "cancel");
- } // end while
-
- } catch (GetPINStatusException ex) {
- String pin = (selectedPIN != null) ? selectedPIN.getLocalizedName() : "pin";
- log.error("failed to get " + pin + " status: " + ex.getMessage());
- gui.showErrorDialog(PINManagementGUIFacade.ERR_STATUS, null,
- this, "ok");
- waitForAction();
- return new ErrorResponse(1000);
- } catch (SignatureCardException ex) {
- log.error(ex.getMessage(), ex);
- gui.showErrorDialog(PINManagementGUIFacade.ERR_UNKNOWN, null,
- this, "ok");
- waitForAction();
- return new ErrorResponse(1000);
- }
- } else {
- log.error("Got unexpected STAL request: " + request);
- return new ErrorResponse(1000);
- }
- }
-
- @Override
- public boolean requireCard() {
- return true;
- }
-
- /**
- * query status for STARCOS card,
- * assume provided status for ACOS card
- * @param pinSpec
- * @param status
- * @throws at.gv.egiz.smcc.SignatureCardException if query status fails
- */
- private void updatePINState(PINSpec pinSpec, STATUS status)
- throws GetPINStatusException {
-
- PINMgmtSignatureCard pmCard = ((PINMgmtSignatureCard) card);
- PIN_STATE pinState;
- try {
- pinState = pmCard.getPINState(pinSpec);
- } catch (SignatureCardException e) {
- String msg = "Failed to get PIN status for pin '"
- + pinSpec.getLocalizedName() + "'.";
- log.info(msg, e);
- throw new GetPINStatusException(msg);
- }
- if (pinState == PIN_STATE.ACTIV) {
- pinStates.put(pinSpec, STATUS.ACTIV);
- } else if (pinState == PIN_STATE.NOT_ACTIV) {
- pinStates.put(pinSpec, STATUS.NOT_ACTIV);
- } else if (pinState == PIN_STATE.BLOCKED) {
- pinStates.put(pinSpec, STATUS.BLOCKED);
- } else {
- pinStates.put(pinSpec, status);
- }
- }
-
-}
diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties
deleted file mode 100644
index 977d6e3a..00000000
--- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright 2008 Federal Chancellery Austria and
-# Graz University of Technology
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-title.activation=Aktivierung
-title.pin.mgmt=PIN Verwaltung
-title.activate.pin=PIN Aktivieren
-title.change.pin=PIN \u00C4ndern
-title.unblock.pin=PIN Entsperren
-title.verify.pin=PIN Eingeben
-title.activate.success=Erfolg
-title.change.success=Erfolg
-
-# removed message.* prefix to reuse keys as help keys
-pin.mgmt=Die Karte verf\u00FCgt \u00FCber {0} PINs
-activate.pin={0} eingeben und best\u00E4tigen
-change.pin={0} eingeben und best\u00E4tigen
-unblock.pin=PUK zu {0} eingeben
-verify.pin={0} eingeben
-verify.pinpad={0} ({1} stellig) am Kartenleser eingeben (und best\u00E4tigen).
-activate.pinpad={0} ({1} stellig) am Kartenleser eingeben und wiederholen (jeweils best\u00E4tigen).
-change.pinpad=Alte {0} ({1} stellig) am Kartenleser eingeben, danach neue {0} eingeben und wiederholen (jeweils best\u00E4tigen).
-unblock.pinpad={0} ({1} stellig) am Kartenleser eingeben (und best\u00E4tigen).
-activate.success={0} wurde erfolgreich aktiviert.
-change.success={0} wurde erfolgreich ge\u00E4ndert.
-
-label.activation=e-card Aktivierungsprozess
-label.activation.step=Schritt {0}
-label.activation.idle=Warte auf Server...
-label.old.pin=Alte {0}:
-label.new.pin=Neue {0}:
-label.repeat.pin=Best\u00E4tigung:
-
-button.activate=Aktivieren
-button.change=\u00C4ndern
-button.unblock=Entsperren
-button.verify=Abfragen
-
-help.activation=help.activation
-help.pin.mgmt=help.pin.mgmt
-
-err.status=Der Status der PINs konnte nicht \u00FCberpr\u00FCft werden.
-err.activate=Beim Aktivieren der {0} trat ein Fehler auf.
-err.change=Beim \u00C4ndern der {0} trat ein Fehler auf.
-err.unblock=Das Entsperren der {0} wird nicht unterst\u00FCtzt.
-err.verify=VERIFY ERROR (TODO)
-err.retries=Falsche {0}, noch {1} Versuche
-err.locked={0} gesperrt.
-err.not.active={0} nicht aktiviert.
-err.pin.format=Ung\u00FCltige {0} L\u00E4nge, verlangt sind {1} Stellen.
-err.pin.confirmation={0} und Best\u00E4tigung stimmen nicht \u00FCberein.
-err.pin.operation.aborted=Der Vorgang f\u00FCr {0} wurde abgebrochen.
-err.unsupported.card=Die Karte wird nicht unterst\u00FCtzt
-
-status.not.active=NICHT AKTIV
-status.active=AKTIV
-status.blocked=GESPERRT
-status.unknown=UNBEKANNT
diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties
deleted file mode 100644
index 7f01971b..00000000
--- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties
+++ /dev/null
@@ -1,68 +0,0 @@
-# Copyright 2008 Federal Chancellery Austria and
-# Graz University of Technology
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-title.activation=Activation
-title.pin.mgmt=PIN Management
-title.activate.pin=Activate PIN
-title.verify.pin=Enter PIN
-title.change.pin=Change PIN
-title.unblock.pin=Unblock PIN
-title.activate.success=Success
-title.change.success=Success
-
-# removed message.* prefix to reuse keys as help keys
-pin.mgmt=The smartcard has {0} PINs
-activate.pin=Enter and confirm {0}
-change.pin=Enter and confirm {0}
-unblock.pin=Enter PUK for {0}
-verify.pin=Enter {0}
-verify.pinpad=Enter {0} ({1} digits) on cardreader (and confirm).
-activate.pinpad=Enter {0} ({1} digits) on cardreader and repeat (confirm in each case).
-change.pinpad=Enter old {0} ({1} digits) on cardreader, then enter new {0} and repeat (confirm in each case).
-unblock.pinpad=Enter {0} ({1} digits) on cardreader (and confirm).
-activate.success={0} successfully activated
-change.success={0} successfully changed
-
-label.activation=e-card activation process
-label.activation.step=Step {0}
-label.activation.idle=Wait for server...
-label.old.pin=Old {0}:
-label.new.pin=New {0}:
-label.repeat.pin=Confirmation:
-
-button.activate=Activate
-button.change=Change
-button.unblock=Unblock
-button.verify=Query
-
-help.activation=help.activation
-help.pin.mgmt=help.pin.mgmt
-
-err.status=PIN statuses could not be read.
-err.activate=An error occured during the activation of {0}.
-err.change=An error occured during the changing of {0}.
-err.unblock=Unblocking of {0} is not supported.
-err.retries=Wrong {0}, {1} tries remaining
-err.locked={0} locked
-err.not.active={0} not activated.
-err.pin.format=Invalid {0} length, {1} digit(s) required.
-err.pin.confirmation={0} and confirmation do not match.
-err.pin.operation.aborted=The operation on {0} was aborted.
-err.unsupported.card=This card is not supported
-
-status.not.active=NOT ACTIVE
-status.active=ACTIVE
-status.blocked=BLOCKED
-status.unknown=UNKNOWN
diff --git a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java
deleted file mode 100644
index 95c5c678..00000000
--- a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
-* Copyright 2008 Federal Chancellery Austria and
-* Graz University of Technology
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package at.gv.egiz.bku.gui;
-
-import java.awt.Container;
-import java.awt.Dimension;
-import javax.swing.JFrame;
-import org.junit.Ignore;
-import org.junit.Test;
-
-
-/**
- *
- * @author clemens
- */
-@Ignore
-public class ActivationGuiTest {
-
- @Test
- public void testBKUGUI() {
- JFrame testFrame = new JFrame("BKUGUITest");
- Container contentPane = testFrame.getContentPane();
- contentPane.setPreferredSize(new Dimension(152, 145));
-// contentPane.setPreferredSize(new Dimension(300, 190));
- ActivationGUIFacade gui = new ActivationGUI(contentPane, null, BKUGUIFacade.Style.tiny, null, null);
- BKUGUIWorker worker = new BKUGUIWorker();
- worker.init(gui);
- testFrame.pack();
- testFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- testFrame.setVisible(true);
- new Thread(worker).start();
-
- while(true) ;
- }
-
- @Test
- public void dummyTest() {
- }
-
-// public static void main(String[] args) {
-// new BKUGUITest().testBKUGUI();
-// }
-}
diff --git a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
deleted file mode 100644
index b01abe72..00000000
--- a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * Copyright 2008 Federal Chancellery Austria and
- * Graz University of Technology
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package at.gv.egiz.bku.gui;
-
-import at.gv.egiz.smcc.PINSpec;
-import at.gv.egiz.stal.HashDataInput;
-import at.gv.egiz.stal.impl.ByteArrayHashDataInput;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- * @author clemens
- */
-public class BKUGUIWorker implements Runnable {
-
- ActivationGUIFacade gui;
-
- public void init(ActivationGUIFacade gui) {
- this.gui = gui;
- }
-
- @Override
- public void run() {
- try {
-
- final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN", (byte)0x00, null);
-
-
- final ActionListener cancelListener = new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- System.out.println("CANCEL EVENT OCCURED: " + e);
- }
- };
- ActionListener okListener = new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- System.out.println("OK EVENT OCCURED: " + e);
- }
- };
- final ActionListener signListener = new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- System.out.println("SIGN EVENT OCCURED: " + e);
- }
- };
- ActionListener hashdataListener = new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- System.out.println("HASHDATA EVENT OCCURED: " + e);
- ActionListener returnListener = new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- gui.showSignaturePINDialog(signPinSpec, -1, signListener, "sign", cancelListener, "cancel", null, "hashdata");
- }
- };
- HashDataInput signedRef1 = new ByteArrayHashDataInput(
- "Ich bin ein einfacher Text mit Umlauten: öäüßéç@€\n123\n456\n\tHello, world!\n\nlkjsd\nnksdjf".getBytes(),
- "ref-id-0000000000000000000000001",
- "text/plain",
- "UTF-8");
-
- HashDataInput signedRef2 = new ByteArrayHashDataInput(
- "HashDataInput_002".getBytes(),
- "ref-id-000000002",
- "application/xhtml+xml",
- "UTF-8");
-
- HashDataInput signedRef3 = new ByteArrayHashDataInput(
- "HashDataInput_003".getBytes(),
- "ref-id-000000003",
- "application/xhtml+xml",
- "UTF-8");
-
- HashDataInput signedRef4 = new ByteArrayHashDataInput(
- "HashDataInput_004".getBytes(),
- "ref-id-000000004",
- "text/xml",
- "UTF-8");
-
- //
- List signedRefs = new ArrayList();
- signedRefs.add(signedRef1);
- signedRefs.add(signedRef2);
- signedRefs.add(signedRef3);
- signedRefs.add(signedRef4);
-// signedRefs.add(signedRef4);
-// signedRefs.add(signedRef4);
-// signedRefs.add(signedRef4);
-// signedRefs.add(signedRef4);
-// signedRefs = Collections.singletonList(signedRef1);
- gui.showSecureViewer(signedRefs, returnListener, "return");
- }
- };
-
-
-
-// gui.showWelcomeDialog();
-//
-// Thread.sleep(2000);
-//
-// gui.showWaitDialog(null);
-//
-// Thread.sleep(1000);
-//
-// gui.showWaitDialog("test");
-//
-// Thread.sleep(1000);
-//
-//
-// gui.showInsertCardDialog(cancelListener, "cancel");
-//
-// Thread.sleep(2000);
-//
-// gui.showCardNotSupportedDialog(cancelListener, "cancel");
-//
-// Thread.sleep(2000);
-//
-// PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN");
-//
-// gui.showCardPINDialog(cardPinSpec, okListener, "ok", cancelListener, "cancel");
-//
-// Thread.sleep(2000);
-//
-// gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
-//
-// Thread.sleep(4000);
-//
-
-// gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, null, null);
-
-// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
-//
-// Thread.sleep(2000);
-//
-// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}, null, null);
-//
-// Thread.sleep(2000);
-//
-// gui.showErrorDialog("error.test", new Object[] {"Testfehler", "noch ein TestFehler"});
-//
-// Thread.sleep(2000);
-//
-// gui.showErrorDialog("error.no.hashdata", null);
-//
-// Thread.sleep(2000);
-//
-// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"});
-//
-// Thread.sleep(2000);
-//
-// gui.showErrorDialog("error.unknown", null);
-
- gui.showActivationProgressDialog(1, 3, null, null);
-
- gui.incrementProgress();
-
- Thread.sleep(1000);
-
- gui.incrementProgress();
-
- Thread.sleep(1000);
-
- gui.incrementProgress();
-
-
- Thread.sleep(1000);
-
- gui.showIdleDialog(null, null);
-
-// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save");
-// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save");
-// Thread.sleep(2000);
-
- } catch (InterruptedException ex) {
- ex.printStackTrace();
- }
- }
-}
diff --git a/BKUCommonGUI/pom.xml b/BKUCommonGUI/pom.xml
index 393a5756..ef6e6692 100644
--- a/BKUCommonGUI/pom.xml
+++ b/BKUCommonGUI/pom.xml
@@ -7,7 +7,7 @@
4.0.0
at.gv.egiz
BKUCommonGUI
- BKU Common GUI
+ BKU GUI
1.2.2-SNAPSHOT
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 de9a91b9..2663e8bf 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
@@ -132,7 +132,7 @@ public class BKUGUIImpl implements BKUGUIFacade {
log.debug("scheduling gui initialization");
- SwingUtilities.invokeAndWait(new Runnable() {
+ SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
diff --git a/BKUGuiExt/pom.xml b/BKUGuiExt/pom.xml
new file mode 100644
index 00000000..87520232
--- /dev/null
+++ b/BKUGuiExt/pom.xml
@@ -0,0 +1,27 @@
+
+
+ 4.0.0
+
+ bku
+ at.gv.egiz
+ 1.2.2-SNAPSHOT
+
+ at.gv.egiz
+ BKUGuiExt
+ 1.2.2-SNAPSHOT
+ BKU GUI Extension
+
+
+ at.gv.egiz
+ STALXService
+ 1.2.2-SNAPSHOT
+
+
+ at.gv.egiz
+ smccSTAL
+ 1.2.2-SNAPSHOT
+
+
+
+
diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java
new file mode 100644
index 00000000..c8927e1e
--- /dev/null
+++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java
@@ -0,0 +1,250 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package at.gv.egiz.bku.gui;
+
+import at.gv.egiz.bku.gui.*;
+import java.awt.Container;
+import java.awt.Cursor;
+import java.awt.event.ActionListener;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import javax.swing.GroupLayout;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JProgressBar;
+import javax.swing.LayoutStyle;
+import javax.swing.SwingUtilities;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class ActivationGUI extends CardMgmtGUI implements ActivationGUIFacade {
+
+ public static final String TITLE_ACTIVATION = "title.activation";
+ public static final String LABEL_ACTIVATION = "label.activation";
+ public static final String LABEL_ACTIVATION_STEP = "label.activation.step";
+ public static final String LABEL_ACTIVATION_IDLE = "label.activation.idle";
+
+ public static final String HELP_ACTIVATION = "help.activation";
+
+ protected JProgressBar progressBar;
+
+ public ActivationGUI(Container contentPane,
+ Locale locale,
+ Style guiStyle,
+ URL backgroundImgURL,
+ AbstractHelpListener helpListener) {
+ super(contentPane, locale, guiStyle, backgroundImgURL, helpListener);
+
+ progressBar = new JProgressBar();
+ }
+
+ @Override
+ public void showActivationProgressDialog(final int currentStep, final int maxProgress, final ActionListener cancelListener, final String cancelCommand) {
+
+ log.debug("scheduling activation progress dialog (step " + currentStep + ")");
+
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+
+ log.debug("show activation progress dialog (step " + currentStep + ")");
+
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
+
+ mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
+
+ JLabel infoLabel = new JLabel();
+ infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+
+ if (renderHeaderPanel) {
+ titleLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION));
+ infoLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION));
+ } else {
+ infoLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION));
+ }
+
+ helpListener.setHelpTopic(HELP_ACTIVATION);
+
+ progressBar.setIndeterminate(false);
+ progressBar.setStringPainted(true);
+ progressBar.setString(null); //reset to percentage
+ progressBar.setMinimum(0);
+ progressBar.setMaximum(maxProgress);
+
+ JLabel stepLabel = new JLabel();
+ stepLabel.setFont(stepLabel.getFont().deriveFont(stepLabel.getFont().getStyle() & ~java.awt.Font.BOLD, stepLabel.getFont().getSize()-2));
+ String stepPattern = cardmgmtMessages.getString(LABEL_ACTIVATION_STEP);
+ stepLabel.setText(MessageFormat.format(stepPattern, new Object[]{ currentStep }));
+
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
+
+ GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup().addComponent(infoLabel);
+ GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(infoLabel);
+
+ if (!renderHeaderPanel) {
+ infoHorizontal.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel);
+ infoVertical.addComponent(helpLabel);
+ }
+
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(infoHorizontal)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(stepLabel)
+ .addComponent(progressBar)));
+
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createSequentialGroup()
+ .addGroup(infoVertical)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addComponent(stepLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(progressBar)));
+
+ JButton cancelButton = new JButton();
+ cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD));
+ cancelButton.setText(messages.getString(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 incrementProgress() {
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ progressBar.setValue(progressBar.getValue() + 1);
+ }
+ });
+
+ }
+
+ @Override
+ public void showIdleDialog(final ActionListener cancelListener, final String cancelCommand) {
+ log.debug("scheduling idle dialog");
+
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+
+ log.debug("show idle dialog");
+
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
+
+ mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
+
+ JLabel infoLabel = new JLabel();
+ infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+
+ if (renderHeaderPanel) {
+ titleLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION));
+ infoLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION));
+ } else {
+ infoLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION));
+ }
+
+ helpListener.setHelpTopic(HELP_ACTIVATION);
+
+ progressBar.setIndeterminate(true);
+ progressBar.setStringPainted(true);
+ progressBar.setString(""); //not string painted progressbar is smaller
+
+ JLabel stepLabel = new JLabel();
+ stepLabel.setFont(stepLabel.getFont().deriveFont(stepLabel.getFont().getStyle() & ~java.awt.Font.BOLD, stepLabel.getFont().getSize()-2));
+ stepLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION_IDLE));
+
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
+
+ GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup().addComponent(infoLabel);
+ GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(infoLabel);
+
+ if (!renderHeaderPanel) {
+ infoHorizontal.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel);
+ infoVertical.addComponent(helpLabel);
+ }
+
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(infoHorizontal)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(stepLabel)
+ .addComponent(progressBar)));
+
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createSequentialGroup()
+ .addGroup(infoVertical)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addComponent(stepLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(progressBar)));
+
+ JButton cancelButton = new JButton();
+ cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD));
+ cancelButton.setText(messages.getString(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();
+
+ }
+ });
+
+ }
+}
diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java
new file mode 100644
index 00000000..3fc14d04
--- /dev/null
+++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package at.gv.egiz.bku.gui;
+
+import at.gv.egiz.bku.gui.*;
+import java.awt.event.ActionListener;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public interface ActivationGUIFacade extends BKUGUIFacade {
+
+ public void showActivationProgressDialog(int currentStep, int maxProgress, ActionListener cancelListener, String cancelCommand);
+
+ public void incrementProgress();
+
+ public void showIdleDialog(ActionListener cancelListener, String cancelCommand);
+
+}
diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java
new file mode 100644
index 00000000..c8e1826c
--- /dev/null
+++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package at.gv.egiz.bku.gui;
+
+import at.gv.egiz.bku.gui.*;
+import java.awt.Container;
+import java.net.URL;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * Common superclass for Activation and PinManagement GUIs
+ *
+ * @author Clemens Orthacker
+ */
+public class CardMgmtGUI extends BKUGUIImpl {
+
+ public static final String CARDMGMT_MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/ActivationMessages";
+
+ protected ResourceBundle cardmgmtMessages;
+
+ public CardMgmtGUI(Container contentPane,
+ Locale locale,
+ Style guiStyle,
+ URL backgroundImgURL,
+ AbstractHelpListener helpListener) {
+ super(contentPane, locale, guiStyle, backgroundImgURL, helpListener);
+
+ }
+
+ @Override
+ protected void loadMessageBundle(Locale locale) {
+ super.loadMessageBundle(locale);
+
+ if (locale != null) {
+ Locale lang = new Locale(locale.getLanguage().substring(0,2));
+ log.debug("loading applet resources for language: " + lang.toString());
+ cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE, lang);
+ } else {
+ cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE);
+ }
+ }
+
+ @Override
+ protected String getMessage(String key) {
+ if (super.hasMessage(key)) {
+ return super.getMessage(key);
+ }
+ return cardmgmtMessages.getString(key);
+ }
+
+ @Override
+ protected boolean hasMessage(String key) {
+ return (cardmgmtMessages.containsKey(key) || super.hasMessage(key));
+ }
+}
diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java
new file mode 100644
index 00000000..3d503510
--- /dev/null
+++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java
@@ -0,0 +1,670 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package at.gv.egiz.bku.gui;
+
+import at.gv.egiz.bku.gui.*;
+import at.gv.egiz.smcc.PINSpec;
+import java.awt.Container;
+import java.awt.Cursor;
+import java.awt.Font;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionAdapter;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.Map;
+import javax.swing.GroupLayout;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JPasswordField;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.LayoutStyle;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingUtilities;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * TODO pull out ResourceBundle to common superclass for activationGUI and pinMgmtGUI
+ * @author Clemens Orthacker
+ */
+public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFacade {
+
+ protected static final Log log = LogFactory.getLog(PINManagementGUI.class);
+
+ /** remember the pinfield to return to worker */
+ protected JPasswordField oldPinField;
+ /** remember the pinSpec to return to worker */
+ protected PINSpec pinSpec;
+
+ public PINManagementGUI(Container contentPane,
+ Locale locale,
+ Style guiStyle,
+ URL backgroundImgURL,
+ AbstractHelpListener helpListener) {
+ super(contentPane, locale, guiStyle, backgroundImgURL, helpListener);
+ }
+
+ @Override
+ public char[] getOldPin() {
+ if (oldPinField != null) {
+ char[] pin = oldPinField.getPassword();
+ oldPinField = null;
+ return pin;
+ }
+ return null;
+ }
+
+ @Override
+ public PINSpec getSelectedPINSpec() {
+ return pinSpec;
+ }
+
+ @Override
+ public void showPINManagementDialog(final Map pins,
+ final ActionListener activateListener,
+ final String activateCmd,
+ final String changeCmd,
+ final String unblockCmd,
+ final String verifyCmd,
+ final ActionListener cancelListener,
+ final String cancelCmd) {
+
+ log.debug("scheduling PIN managment dialog");
+
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ log.debug("show PIN management dialog");
+
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
+
+ helpListener.setHelpTopic(HELP_PINMGMT);
+
+ JLabel mgmtLabel = new JLabel();
+ mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+
+ if (renderHeaderPanel) {
+ titleLabel.setText(getMessage(TITLE_PINMGMT));
+ String infoPattern = getMessage(MESSAGE_PINMGMT);
+ mgmtLabel.setText(MessageFormat.format(infoPattern, pins.size()));
+ } else {
+ mgmtLabel.setText(getMessage(TITLE_PINMGMT));
+ }
+
+ final PINStatusTableModel tableModel = new PINStatusTableModel(pins);
+ final JTable pinStatusTable = new JTable(tableModel);
+ pinStatusTable.setDefaultRenderer(PINSpec.class, new PINSpecRenderer());
+ pinStatusTable.setDefaultRenderer(STATUS.class, new PINStatusRenderer(cardmgmtMessages));
+ pinStatusTable.setTableHeader(null);
+ pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+// pinStatusTable.addMouseMotionListener(new MouseMotionAdapter() {
+//
+// @Override
+// public void mouseMoved(MouseEvent e) {
+// if (pinStatusTable.columnAtPoint(e.getPoint()) == 0) {
+// pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+// } else {
+// pinStatusTable.setCursor(Cursor.getDefaultCursor());
+// }
+// }
+// });
+
+ final JButton activateButton = new JButton();
+ activateButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD));
+ activateButton.addActionListener(activateListener);
+
+ pinStatusTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ pinStatusTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+
+ @Override
+ public void valueChanged(final ListSelectionEvent e) {
+ //invoke later to allow thread to paint selection background
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ ListSelectionModel lsm = (ListSelectionModel) e.getSource();
+ int selectionIdx = lsm.getMinSelectionIndex();
+ if (selectionIdx >= 0) {
+ pinSpec = (PINSpec) tableModel.getValueAt(selectionIdx, 0);
+ STATUS status = (STATUS) tableModel.getValueAt(selectionIdx, 1);
+
+ if (status == STATUS.NOT_ACTIV) {
+ activateButton.setText(getMessage(BUTTON_ACTIVATE));
+ activateButton.setEnabled(true);
+ activateButton.setActionCommand(activateCmd);
+ } else if (status == STATUS.BLOCKED) {
+ activateButton.setText(getMessage(BUTTON_UNBLOCK));
+ activateButton.setEnabled(true);
+ activateButton.setActionCommand(unblockCmd);
+ } else if (status == STATUS.ACTIV) {
+ activateButton.setText(getMessage(BUTTON_CHANGE));
+ activateButton.setEnabled(true);
+ activateButton.setActionCommand(changeCmd);
+ } else if (status == STATUS.UNKNOWN) {
+ activateButton.setText(getMessage(BUTTON_VERIFY));
+ activateButton.setEnabled(true);
+ activateButton.setActionCommand(verifyCmd);
+ }
+ }
+ }
+ });
+ }
+ });
+
+ //select first entry
+ pinStatusTable.getSelectionModel().setSelectionInterval(0, 0);
+
+ JScrollPane pinStatusScrollPane = new JScrollPane(pinStatusTable);
+
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
+
+ GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup()
+ .addComponent(mgmtLabel);
+ GroupLayout.Group messageVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(mgmtLabel);
+ if (!renderHeaderPanel) {
+ messageHorizontal
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel);
+ messageVertical
+ .addComponent(helpLabel);
+ }
+
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(messageHorizontal)
+ .addComponent(pinStatusScrollPane, 0, 0, Short.MAX_VALUE));
+
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createSequentialGroup()
+ .addGroup(messageVertical)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(pinStatusScrollPane, 0, 0, pinStatusTable.getPreferredSize().height+3));
+
+ JButton cancelButton = new JButton();
+ cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD));
+ cancelButton.setText(getMessage(BUTTON_CLOSE));
+ cancelButton.setActionCommand(cancelCmd);
+ cancelButton.addActionListener(cancelListener);
+
+ GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+ buttonPanel.setLayout(buttonPanelLayout);
+
+ GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(activateButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE);
+
+ GroupLayout.Group buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(activateButton)
+ .addComponent(cancelButton);
+
+ buttonPanelLayout.setHorizontalGroup(buttonHorizontal);
+ buttonPanelLayout.setVerticalGroup(buttonVertical);
+
+ contentPanel.validate();
+ }
+ });
+ }
+
+ @Override
+ public void showPINDialog(DIALOG type, PINSpec pinSpec,
+ ActionListener okListener, String okCommand,
+ ActionListener cancelListener, String cancelCommand) {
+ showPINDialog(type, pinSpec, -1, false,
+ okListener, okCommand, cancelListener, cancelCommand);
+ }
+
+ @Override
+ public void showPINDialog(DIALOG type, PINSpec pinSpec, int retries,
+ ActionListener okListener, String okCommand,
+ ActionListener cancelListener, String cancelCommand) {
+ showPINDialog(type, pinSpec, retries, false,
+ okListener, okCommand, cancelListener, cancelCommand);
+ }
+
+ @Override
+ public void showPinpadPINDialog(DIALOG type, PINSpec pinSpec, int retries) {
+ String title, msg;
+ Object[] params;
+ if (retries < 0) {
+ params = new Object[2];
+ if (shortText) {
+ params[0] = "PIN";
+ } else {
+ params[0] = pinSpec.getLocalizedName();
+ }
+ params[1] = pinSpec.getLocalizedLength();
+ if (type == DIALOG.CHANGE) {
+ log.debug("show change pin dialog");
+ title = TITLE_CHANGE_PIN;
+ msg = MESSAGE_CHANGEPIN_PINPAD;
+ } else if (type == DIALOG.ACTIVATE) {
+ log.debug("show activate pin dialog");
+ title = TITLE_ACTIVATE_PIN;
+ msg = MESSAGE_ENTERPIN_PINPAD;
+ } else if (type == DIALOG.VERIFY) {
+ log.debug("show verify pin dialog");
+ title = TITLE_VERIFY_PIN;
+ msg = MESSAGE_ENTERPIN_PINPAD;
+ } else {
+ log.debug("show unblock pin dialog");
+ title = TITLE_UNBLOCK_PIN;
+ msg = MESSAGE_ENTERPIN_PINPAD;
+ }
+
+ } else {
+ log.debug("show retry pin dialog");
+ title = TITLE_RETRY;
+ msg = (retries < 2) ?
+ MESSAGE_LAST_RETRY : MESSAGE_RETRIES;
+ params = new Object[] {String.valueOf(retries)};
+ }
+ showMessageDialog(title, msg, params);
+ }
+
+ private void showPINDialog(final DIALOG type, final PINSpec pinSpec,
+ final int retries, final boolean pinpad,
+ final ActionListener okListener, final String okCommand,
+ final ActionListener cancelListener, final String cancelCommand) {
+
+ log.debug("scheduling pin dialog");
+
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+
+ String HELP_TOPIC, TITLE, MESSAGE_MGMT, MESSAGE_MGMT_PARAM, PINSIZE;
+ HELP_TOPIC = HELP_PINMGMT;
+
+ PINSIZE = (pinSpec.getMaxLength() > pinSpec.getMinLength()) ?
+ pinSpec.getMinLength() + "-" + pinSpec.getMaxLength() :
+ String.valueOf(pinSpec.getMinLength());
+
+ if (retries < 0) {
+ if (type == DIALOG.CHANGE) {
+ log.debug("show change pin dialog");
+ TITLE = TITLE_CHANGE_PIN;
+ MESSAGE_MGMT = MESSAGE_CHANGE_PIN;
+ } else if (type == DIALOG.ACTIVATE) {
+ log.debug("show activate pin dialog");
+ TITLE = TITLE_ACTIVATE_PIN;
+ MESSAGE_MGMT = MESSAGE_ACTIVATE_PIN;
+ oldPinField = null;
+ PINSIZE = pinSpec.getLocalizedLength();
+ } else if (type == DIALOG.VERIFY) {
+ log.debug("show verify pin dialog");
+ TITLE = TITLE_VERIFY_PIN;
+ MESSAGE_MGMT = MESSAGE_VERIFY_PIN;
+ } else {
+ log.debug("show unblock pin dialog");
+ TITLE = TITLE_UNBLOCK_PIN;
+ MESSAGE_MGMT = MESSAGE_UNBLOCK_PIN;
+ }
+ if (shortText) {
+ MESSAGE_MGMT_PARAM = "PIN";
+ } else {
+ MESSAGE_MGMT_PARAM = pinSpec.getLocalizedName();
+ }
+ } else {
+ log.debug("show retry pin dialog");
+ TITLE = TITLE_RETRY;
+ MESSAGE_MGMT = (retries < 2) ?
+ MESSAGE_LAST_RETRY : MESSAGE_RETRIES;
+ MESSAGE_MGMT_PARAM = String.valueOf(retries);
+ }
+
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
+
+ helpListener.setHelpTopic(HELP_TOPIC);
+
+ JLabel mgmtLabel = new JLabel();
+ if (retries < 0) {
+ mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD));
+ } else {
+ mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() | Font.BOLD));
+ mgmtLabel.setForeground(ERROR_COLOR);
+ helpListener.setHelpTopic(HELP_RETRY);
+ }
+
+ if (renderHeaderPanel) {
+ titleLabel.setText(getMessage(TITLE));
+ String mgmtPattern = getMessage(MESSAGE_MGMT);
+ mgmtLabel.setText(MessageFormat.format(mgmtPattern, MESSAGE_MGMT_PARAM));
+ } else {
+ mgmtLabel.setText(getMessage(TITLE));
+ }
+
+ ////////////////////////////////////////////////////////////////
+ // COMMON LAYOUT SECTION
+ ////////////////////////////////////////////////////////////////
+
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
+
+ GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup()
+ .addComponent(mgmtLabel);
+ GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(mgmtLabel);
+
+ if (!renderHeaderPanel) {
+ infoHorizontal
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel);
+ infoVertical
+ .addComponent(helpLabel);
+ }
+
+ GroupLayout.ParallelGroup pinHorizontal;
+ GroupLayout.SequentialGroup pinVertical;
+
+ if (pinpad) {
+ JLabel pinpadLabel = new JLabel();
+ pinpadLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD));
+ String pinpadPattern = getMessage(MESSAGE_VERIFYPIN_PINPAD);
+ pinpadLabel.setText(MessageFormat.format(pinpadPattern,
+ new Object[] { pinSpec.getLocalizedName(), PINSIZE }));
+
+ pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(pinpadLabel);
+ pinVertical = mainPanelLayout.createSequentialGroup()
+ .addComponent(pinpadLabel);
+ } else {
+
+ JButton okButton = new JButton();
+ okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~Font.BOLD));
+ okButton.setText(getMessage(BUTTON_OK));
+ okButton.setEnabled(pinSpec.getMinLength() <= 0);
+ okButton.setActionCommand(okCommand);
+ okButton.addActionListener(okListener);
+
+ JLabel oldPinLabel = null;
+ JLabel repeatPinLabel = null;
+ JLabel pinLabel = new JLabel();
+ pinLabel.setFont(pinLabel.getFont().deriveFont(pinLabel.getFont().getStyle() & ~Font.BOLD));
+ String pinLabelPattern = (type == DIALOG.CHANGE) ? getMessage(LABEL_NEW_PIN) : getMessage(LABEL_PIN);
+ pinLabel.setText(MessageFormat.format(pinLabelPattern, new Object[]{pinSpec.getLocalizedName()}));
+
+ final JPasswordField repeatPinField = new JPasswordField();
+ pinField = new JPasswordField();
+ pinField.setText("");
+ pinField.setActionCommand(okCommand);
+ pinField.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (pinField.getPassword().length >= pinSpec.getMinLength()) {
+ if (type == DIALOG.VERIFY) {
+ okListener.actionPerformed(e);
+ } else {
+ repeatPinField.requestFocusInWindow();
+ }
+ }
+ }
+ });
+
+ if (type != DIALOG.VERIFY) {
+ pinField.setDocument(new PINDocument(pinSpec, null));
+ repeatPinLabel = new JLabel();
+ repeatPinLabel.setFont(pinLabel.getFont());
+ String repeatPinLabelPattern = getMessage(LABEL_REPEAT_PIN);
+ repeatPinLabel.setText(MessageFormat.format(repeatPinLabelPattern, new Object[]{pinSpec.getLocalizedName()}));
+
+ repeatPinField.setText("");
+// repeatPinField.setDocument(new PINDocument(pinSpec, okButton, pinField.getDocument()));
+ repeatPinField.setActionCommand(okCommand);
+ repeatPinField.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (pinField.getPassword().length >= pinSpec.getMinLength()) {
+ okListener.actionPerformed(e);
+ }
+ }
+ });
+
+ if (type == DIALOG.CHANGE) {
+ oldPinLabel = new JLabel();
+ oldPinLabel.setFont(oldPinLabel.getFont().deriveFont(oldPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ String oldPinLabelPattern = getMessage(LABEL_OLD_PIN);
+ oldPinLabel.setText(MessageFormat.format(oldPinLabelPattern, new Object[]{pinSpec.getLocalizedName()}));
+
+ oldPinField = new JPasswordField();
+ oldPinField.setText("");
+ oldPinField.setDocument(new PINDocument(pinSpec, null));
+ oldPinField.setActionCommand(okCommand);
+ oldPinField.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (oldPinField.getPassword().length >= pinSpec.getMinLength()) {
+ pinField.requestFocusInWindow();
+ }
+ }
+ });
+
+ repeatPinField.setDocument(new PINDocument(
+ pinSpec, okButton,
+ pinField.getDocument(), oldPinField.getDocument()));
+ } else {
+ // else -> ACTIVATE (not verify, not change)
+ repeatPinField.setDocument(new PINDocument(
+ pinSpec, okButton, pinField.getDocument()));
+ }
+ } else {
+ pinField.setDocument(new PINDocument(pinSpec, okButton));
+ }
+
+ JLabel pinsizeLabel = new JLabel();
+ pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~Font.BOLD, pinsizeLabel.getFont().getSize()-2));
+ String pinsizePattern = getMessage(LABEL_PINSIZE);
+ pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{PINSIZE}));
+
+ ////////////////////////////////////////////////////////////////
+ // NON-PINPAD SPECIFIC LAYOUT SECTION
+ ////////////////////////////////////////////////////////////////
+
+ pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
+ pinVertical = mainPanelLayout.createSequentialGroup();
+
+// if (pinLabelPos == PinLabelPosition.ABOVE) {
+// if (changePin) {
+// pinHorizontal
+// .addComponent(oldPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+// .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE);
+// pinVertical
+// .addComponent(oldPinLabel)
+// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+// .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
+// }
+// pinHorizontal
+// .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+// .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+// .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+// .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+// .addGroup(mainPanelLayout.createSequentialGroup()
+// .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+// .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE));
+// pinVertical
+// .addComponent(pinLabel)
+// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+// .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+// .addComponent(repeatPinLabel)
+// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+// .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+// .addComponent(pinsizeLabel);
+// } else {
+
+
+ if (type == DIALOG.CHANGE) {
+ pinHorizontal
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(oldPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
+
+ pinVertical
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(oldPinLabel)
+ .addComponent(oldPinField))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(pinLabel)
+ .addComponent(pinField))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(repeatPinLabel)
+ .addComponent(repeatPinField))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
+ } else if (type == DIALOG.ACTIVATE) {
+ pinHorizontal
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
+
+ pinVertical
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(pinLabel)
+ .addComponent(pinField))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(repeatPinLabel)
+ .addComponent(repeatPinField))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
+ } else { // VERIFY
+ pinHorizontal
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
+
+ pinVertical
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(pinLabel)
+ .addComponent(pinField))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
+ }
+ pinHorizontal
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE));
+ pinVertical
+ .addComponent(pinsizeLabel);
+
+ GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+ buttonPanel.setLayout(buttonPanelLayout);
+
+ GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE);
+ GroupLayout.Group buttonVertical;
+
+ JButton cancelButton = new JButton();
+ cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD));
+ cancelButton.setText(getMessage(BUTTON_CANCEL));
+ cancelButton.setActionCommand(cancelCommand);
+ cancelButton.addActionListener(cancelListener);
+
+ buttonHorizontal
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE);
+ buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(okButton)
+ .addComponent(cancelButton);
+
+ buttonPanelLayout.setHorizontalGroup(buttonHorizontal);
+ buttonPanelLayout.setVerticalGroup(buttonVertical);
+
+ if (oldPinField != null) {
+ oldPinField.requestFocusInWindow();
+ } else {
+ pinField.requestFocusInWindow();
+ }
+
+ } // END NON-PINPAD SECTION
+
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(infoHorizontal)
+ .addGroup(pinHorizontal));
+
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createSequentialGroup()
+ .addGroup(infoVertical)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(pinVertical));
+
+ contentPanel.validate();
+
+ }
+ });
+ }
+
+ @Override
+ protected int initButtonSize() {
+ int bs = super.initButtonSize();
+
+ JButton b = new JButton();
+ b.setText(getMessage(BUTTON_ACTIVATE));
+ if (b.getPreferredSize().width > bs) {
+ bs = b.getPreferredSize().width;
+ }
+ b.setText(getMessage(BUTTON_CHANGE));
+ if (b.getPreferredSize().width > bs) {
+ bs = b.getPreferredSize().width;
+ }
+ b.setText(getMessage(BUTTON_UNBLOCK));
+ if (b.getPreferredSize().width > bs) {
+ bs = b.getPreferredSize().width;
+ }
+ b.setText(getMessage(BUTTON_CANCEL));
+ if (b.getPreferredSize().width > bs) {
+ bs = b.getPreferredSize().width;
+ }
+
+ return bs;
+ }
+
+}
diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java
new file mode 100644
index 00000000..297173d9
--- /dev/null
+++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package at.gv.egiz.bku.gui;
+
+import at.gv.egiz.bku.gui.*;
+import at.gv.egiz.smcc.PINSpec;
+import java.awt.event.ActionListener;
+import java.util.Map;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public interface PINManagementGUIFacade extends BKUGUIFacade {
+
+ public static final String HELP_PINMGMT = "help.pin.mgmt";
+// public static final String HELP_VERIFY_PIN = "help.pin.verify";
+ public static final String TITLE_PINMGMT = "title.pin.mgmt";
+ public static final String TITLE_ACTIVATE_PIN = "title.activate.pin";
+ public static final String TITLE_CHANGE_PIN = "title.change.pin";
+ public static final String TITLE_VERIFY_PIN = "title.verify.pin";
+ public static final String TITLE_UNBLOCK_PIN = "title.unblock.pin";
+ public static final String TITLE_ACTIVATE_SUCCESS = "title.activate.success";
+ public static final String TITLE_CHANGE_SUCCESS = "title.change.success";
+
+ // removed message.* prefix to reuse keys as help keys
+ public static final String MESSAGE_ACTIVATE_SUCCESS = "activate.success";
+ public static final String MESSAGE_CHANGE_SUCCESS = "change.success";
+ public static final String MESSAGE_PINMGMT = "pin.mgmt";
+// public static final String MESSAGE_PINPAD = "pinpad";
+ public static final String MESSAGE_ACTIVATE_PIN = "activate.pin";
+ public static final String MESSAGE_CHANGE_PIN = "change.pin";
+ public static final String MESSAGE_VERIFY_PIN = "verify.pin";
+ public static final String MESSAGE_UNBLOCK_PIN = "unblock.pin";
+ public static final String MESSAGE_ACTIVATEPIN_PINPAD = "activate.pinpad";
+ public static final String MESSAGE_CHANGEPIN_PINPAD = "change.pinpad";
+ public static final String MESSAGE_VERIFYPIN_PINPAD = "verify.pinpad";
+ public static final String MESSAGE_UNBLOCKPIN_PINPAD = "unblock.pinpad";
+
+ public static final String LABEL_OLD_PIN = "label.old.pin";
+ public static final String LABEL_NEW_PIN = "label.new.pin";
+ public static final String LABEL_REPEAT_PIN = "label.repeat.pin";
+
+ public static final String ERR_STATUS = "err.status";
+ public static final String ERR_ACTIVATE = "err.activate";
+ public static final String ERR_CHANGE = "err.change";
+ public static final String ERR_UNBLOCK = "err.unblock";
+ public static final String ERR_VERIFY = "err.verify";
+ public static final String ERR_RETRIES = "err.retries";
+ public static final String ERR_LOCKED = "err.locked";
+ public static final String ERR_NOT_ACTIVE = "err.not.active";
+ public static final String ERR_PIN_FORMAT = "err.pin.format";
+ public static final String ERR_PIN_CONFIRMATION = "err.pin.confirmation";
+ public static final String ERR_PIN_OPERATION_ABORTED = "err.pin.operation.aborted";
+ public static final String ERR_UNSUPPORTED_CARD = "err.unsupported.card";
+
+ public static final String BUTTON_ACTIVATE = "button.activate";
+ public static final String BUTTON_UNBLOCK = "button.unblock";
+ public static final String BUTTON_CHANGE = "button.change";
+ public static final String BUTTON_VERIFY = "button.verify";
+
+ public static final String STATUS_ACTIVE = "status.active";
+ public static final String STATUS_BLOCKED = "status.blocked";
+ public static final String STATUS_NOT_ACTIVE = "status.not.active";
+ public static final String STATUS_UNKNOWN = "status.unknown";
+
+ public enum STATUS { ACTIV, NOT_ACTIV, BLOCKED, UNKNOWN };
+ public enum DIALOG { VERIFY, ACTIVATE, CHANGE, UNBLOCK };
+
+ public void showPINManagementDialog(Map pins,
+ ActionListener activateListener, String activateCmd, String changeCmd, String unblockCmd, String verifyCmd,
+ ActionListener cancelListener, String cancelCmd);
+
+ public void showPINDialog(DIALOG type, PINSpec pin,
+ ActionListener okListener, String okCmd,
+ ActionListener cancelListener, String cancelCmd);
+
+ public void showPINDialog(DIALOG type, PINSpec pin, int retries,
+ ActionListener okListener, String okCmd,
+ ActionListener cancelListener, String cancelCmd);
+
+ public void showPinpadPINDialog(DIALOG type, PINSpec pin, int retries);
+
+// public void showActivatePINDialog(PINSpec pin,
+// ActionListener okListener, String okCmd,
+// ActionListener cancelListener, String cancelCmd);
+//
+// public void showChangePINDialog(PINSpec pin,
+// ActionListener okListener, String okCmd,
+// ActionListener cancelListener, String cancelCmd);
+//
+// public void showUnblockPINDialog(PINSpec pin,
+// ActionListener okListener, String okCmd,
+// ActionListener cancelListener, String cancelCmd);
+//
+// public void showVerifyPINDialog(PINSpec pin,
+// ActionListener okListener, String okCmd,
+// ActionListener cancelListener, String cancelCmd);
+
+ public char[] getOldPin();
+
+ public PINSpec getSelectedPINSpec();
+}
diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java
new file mode 100644
index 00000000..e3d73e1f
--- /dev/null
+++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package at.gv.egiz.bku.gui;
+
+import at.gv.egiz.smcc.PINSpec;
+import javax.swing.table.DefaultTableCellRenderer;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class PINSpecRenderer extends DefaultTableCellRenderer {
+
+ private static final Log log = LogFactory.getLog(PINSpecRenderer.class);
+
+ @Override
+ protected void setValue(Object value) {
+ PINSpec pinSpec = (PINSpec) value;
+ super.setText(pinSpec.getLocalizedName());
+ }
+
+}
diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java
new file mode 100644
index 00000000..83ff74f2
--- /dev/null
+++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package at.gv.egiz.bku.gui;
+
+import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS;
+import java.awt.Color;
+import java.awt.Font;
+import java.util.ResourceBundle;
+import javax.swing.table.DefaultTableCellRenderer;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class PINStatusRenderer extends DefaultTableCellRenderer {
+
+// private static final Log log = LogFactory.getLog(PINStatusRenderer.class);
+
+ public static final Color RED = new Color(0.9f, 0.0f, 0.0f);
+ public static final Color GREEN = new Color(0.0f, 0.8f, 0.0f);
+ protected ResourceBundle messages;
+
+ public PINStatusRenderer(ResourceBundle messages) {
+ this.messages = messages;
+ }
+
+ @Override
+ protected void setValue(Object value) {
+ STATUS pinStatus = (STATUS) value;
+ super.setFont(super.getFont().deriveFont(super.getFont().getStyle() | Font.BOLD));
+
+ if (pinStatus == STATUS.NOT_ACTIV) {
+ super.setForeground(RED);
+ super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_NOT_ACTIVE) + "");
+ } else if (pinStatus == STATUS.ACTIV) {
+ super.setForeground(GREEN);
+ super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_ACTIVE) + "");
+ } else if (pinStatus == STATUS.BLOCKED) {
+ super.setForeground(RED);
+ super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_BLOCKED) + "");
+ } else {
+ super.setForeground(Color.BLACK);
+ super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_UNKNOWN) + "");
+ }
+ }
+}
diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java
new file mode 100644
index 00000000..052c13b2
--- /dev/null
+++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package at.gv.egiz.bku.gui;
+
+import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS;
+import at.gv.egiz.smcc.PINSpec;
+import java.util.Map;
+import javax.swing.table.DefaultTableModel;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class PINStatusTableModel extends DefaultTableModel {
+
+// protected static final Log log = LogFactory.getLog(PINStatusTableModel.class);
+ protected Class[] types;
+
+ public PINStatusTableModel(Map pinStatuses) {
+ super(0, 2);
+ if (pinStatuses == null) {
+ throw new RuntimeException("pinStatuses must not be null");
+ }
+// log.trace(pinStatuses.size() + " PINs");
+ types = new Class[] { PINSpec.class, STATUS.class };
+ for (PINSpec pinSpec : pinStatuses.keySet()) {
+ addRow(new Object[] { pinSpec, pinStatuses.get(pinSpec) });
+ }
+// PINSpec activePIN = new PINSpec(0, 1, null, "active-PIN", (byte) 0x01);
+// PINSpec blockedPIN = new PINSpec(0, 1, null, "blocked-PIN", (byte) 0x01);
+// addRow(new Object[] { activePIN, PINStatusProvider.STATUS.ACTIV });
+// addRow(new Object[] { blockedPIN, PINStatusProvider.STATUS.BLOCKED });
+ }
+
+ @Override
+ public Class getColumnClass(int columnIndex) {
+ return types[columnIndex];
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ return false;
+ }
+}
diff --git a/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties
new file mode 100644
index 00000000..977d6e3a
--- /dev/null
+++ b/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties
@@ -0,0 +1,69 @@
+# Copyright 2008 Federal Chancellery Austria and
+# Graz University of Technology
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+title.activation=Aktivierung
+title.pin.mgmt=PIN Verwaltung
+title.activate.pin=PIN Aktivieren
+title.change.pin=PIN \u00C4ndern
+title.unblock.pin=PIN Entsperren
+title.verify.pin=PIN Eingeben
+title.activate.success=Erfolg
+title.change.success=Erfolg
+
+# removed message.* prefix to reuse keys as help keys
+pin.mgmt=Die Karte verf\u00FCgt \u00FCber {0} PINs
+activate.pin={0} eingeben und best\u00E4tigen
+change.pin={0} eingeben und best\u00E4tigen
+unblock.pin=PUK zu {0} eingeben
+verify.pin={0} eingeben
+verify.pinpad={0} ({1} stellig) am Kartenleser eingeben (und best\u00E4tigen).
+activate.pinpad={0} ({1} stellig) am Kartenleser eingeben und wiederholen (jeweils best\u00E4tigen).
+change.pinpad=Alte {0} ({1} stellig) am Kartenleser eingeben, danach neue {0} eingeben und wiederholen (jeweils best\u00E4tigen).
+unblock.pinpad={0} ({1} stellig) am Kartenleser eingeben (und best\u00E4tigen).
+activate.success={0} wurde erfolgreich aktiviert.
+change.success={0} wurde erfolgreich ge\u00E4ndert.
+
+label.activation=e-card Aktivierungsprozess
+label.activation.step=Schritt {0}
+label.activation.idle=Warte auf Server...
+label.old.pin=Alte {0}:
+label.new.pin=Neue {0}:
+label.repeat.pin=Best\u00E4tigung:
+
+button.activate=Aktivieren
+button.change=\u00C4ndern
+button.unblock=Entsperren
+button.verify=Abfragen
+
+help.activation=help.activation
+help.pin.mgmt=help.pin.mgmt
+
+err.status=Der Status der PINs konnte nicht \u00FCberpr\u00FCft werden.
+err.activate=Beim Aktivieren der {0} trat ein Fehler auf.
+err.change=Beim \u00C4ndern der {0} trat ein Fehler auf.
+err.unblock=Das Entsperren der {0} wird nicht unterst\u00FCtzt.
+err.verify=VERIFY ERROR (TODO)
+err.retries=Falsche {0}, noch {1} Versuche
+err.locked={0} gesperrt.
+err.not.active={0} nicht aktiviert.
+err.pin.format=Ung\u00FCltige {0} L\u00E4nge, verlangt sind {1} Stellen.
+err.pin.confirmation={0} und Best\u00E4tigung stimmen nicht \u00FCberein.
+err.pin.operation.aborted=Der Vorgang f\u00FCr {0} wurde abgebrochen.
+err.unsupported.card=Die Karte wird nicht unterst\u00FCtzt
+
+status.not.active=NICHT AKTIV
+status.active=AKTIV
+status.blocked=GESPERRT
+status.unknown=UNBEKANNT
diff --git a/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties
new file mode 100644
index 00000000..7f01971b
--- /dev/null
+++ b/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties
@@ -0,0 +1,68 @@
+# Copyright 2008 Federal Chancellery Austria and
+# Graz University of Technology
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+title.activation=Activation
+title.pin.mgmt=PIN Management
+title.activate.pin=Activate PIN
+title.verify.pin=Enter PIN
+title.change.pin=Change PIN
+title.unblock.pin=Unblock PIN
+title.activate.success=Success
+title.change.success=Success
+
+# removed message.* prefix to reuse keys as help keys
+pin.mgmt=The smartcard has {0} PINs
+activate.pin=Enter and confirm {0}
+change.pin=Enter and confirm {0}
+unblock.pin=Enter PUK for {0}
+verify.pin=Enter {0}
+verify.pinpad=Enter {0} ({1} digits) on cardreader (and confirm).
+activate.pinpad=Enter {0} ({1} digits) on cardreader and repeat (confirm in each case).
+change.pinpad=Enter old {0} ({1} digits) on cardreader, then enter new {0} and repeat (confirm in each case).
+unblock.pinpad=Enter {0} ({1} digits) on cardreader (and confirm).
+activate.success={0} successfully activated
+change.success={0} successfully changed
+
+label.activation=e-card activation process
+label.activation.step=Step {0}
+label.activation.idle=Wait for server...
+label.old.pin=Old {0}:
+label.new.pin=New {0}:
+label.repeat.pin=Confirmation:
+
+button.activate=Activate
+button.change=Change
+button.unblock=Unblock
+button.verify=Query
+
+help.activation=help.activation
+help.pin.mgmt=help.pin.mgmt
+
+err.status=PIN statuses could not be read.
+err.activate=An error occured during the activation of {0}.
+err.change=An error occured during the changing of {0}.
+err.unblock=Unblocking of {0} is not supported.
+err.retries=Wrong {0}, {1} tries remaining
+err.locked={0} locked
+err.not.active={0} not activated.
+err.pin.format=Invalid {0} length, {1} digit(s) required.
+err.pin.confirmation={0} and confirmation do not match.
+err.pin.operation.aborted=The operation on {0} was aborted.
+err.unsupported.card=This card is not supported
+
+status.not.active=NOT ACTIVE
+status.active=ACTIVE
+status.blocked=BLOCKED
+status.unknown=UNKNOWN
diff --git a/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java
new file mode 100644
index 00000000..49ae577b
--- /dev/null
+++ b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java
@@ -0,0 +1,63 @@
+/*
+* Copyright 2008 Federal Chancellery Austria and
+* Graz University of Technology
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package at.gv.egiz.bku.gui;
+
+import at.gv.egiz.bku.gui.*;
+import java.awt.Container;
+import java.awt.Dimension;
+import javax.swing.JFrame;
+import org.junit.Ignore;
+import org.junit.Test;
+
+
+/**
+ *
+ * @author clemens
+ */
+@Ignore
+public class ActivationGuiTest {
+
+ @Test
+ public void testBKUGUI() {
+ JFrame testFrame = new JFrame("BKUGUITest");
+ Container contentPane = testFrame.getContentPane();
+ contentPane.setPreferredSize(new Dimension(152, 145));
+// contentPane.setPreferredSize(new Dimension(300, 190));
+ ActivationGUIFacade gui = new ActivationGUI(contentPane, null, BKUGUIFacade.Style.tiny, null, null);
+ BKUGUIWorker worker = new BKUGUIWorker();
+ worker.init(gui);
+ testFrame.pack();
+ testFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ testFrame.setVisible(true);
+ new Thread(worker).start();
+
+ while(true) ;
+ }
+
+ @Test
+ public void dummyTest() {
+ }
+
+// public static void main(String[] args) {
+// new BKUGUITest().testBKUGUI();
+// }
+}
diff --git a/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
new file mode 100644
index 00000000..74ea8952
--- /dev/null
+++ b/BKUGuiExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package at.gv.egiz.bku.gui;
+
+import at.gv.egiz.bku.gui.*;
+import at.gv.egiz.smcc.PINSpec;
+import at.gv.egiz.stal.HashDataInput;
+import at.gv.egiz.stal.impl.ByteArrayHashDataInput;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ *
+ * @author clemens
+ */
+public class BKUGUIWorker implements Runnable {
+
+ ActivationGUIFacade gui;
+
+ public void init(ActivationGUIFacade gui) {
+ this.gui = gui;
+ }
+
+ @Override
+ public void run() {
+ try {
+
+ final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN", (byte)0x00, null);
+
+
+ final ActionListener cancelListener = new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ System.out.println("CANCEL EVENT OCCURED: " + e);
+ }
+ };
+ ActionListener okListener = new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ System.out.println("OK EVENT OCCURED: " + e);
+ }
+ };
+ final ActionListener signListener = new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ System.out.println("SIGN EVENT OCCURED: " + e);
+ }
+ };
+ ActionListener hashdataListener = new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ System.out.println("HASHDATA EVENT OCCURED: " + e);
+ ActionListener returnListener = new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ gui.showSignaturePINDialog(signPinSpec, -1, signListener, "sign", cancelListener, "cancel", null, "hashdata");
+ }
+ };
+ HashDataInput signedRef1 = new ByteArrayHashDataInput(
+ "Ich bin ein einfacher Text mit Umlauten: öäüßéç@€\n123\n456\n\tHello, world!\n\nlkjsd\nnksdjf".getBytes(),
+ "ref-id-0000000000000000000000001",
+ "text/plain",
+ "UTF-8");
+
+ HashDataInput signedRef2 = new ByteArrayHashDataInput(
+ "HashDataInput_002".getBytes(),
+ "ref-id-000000002",
+ "application/xhtml+xml",
+ "UTF-8");
+
+ HashDataInput signedRef3 = new ByteArrayHashDataInput(
+ "HashDataInput_003".getBytes(),
+ "ref-id-000000003",
+ "application/xhtml+xml",
+ "UTF-8");
+
+ HashDataInput signedRef4 = new ByteArrayHashDataInput(
+ "HashDataInput_004".getBytes(),
+ "ref-id-000000004",
+ "text/xml",
+ "UTF-8");
+
+ //
+ List signedRefs = new ArrayList();
+ signedRefs.add(signedRef1);
+ signedRefs.add(signedRef2);
+ signedRefs.add(signedRef3);
+ signedRefs.add(signedRef4);
+// signedRefs.add(signedRef4);
+// signedRefs.add(signedRef4);
+// signedRefs.add(signedRef4);
+// signedRefs.add(signedRef4);
+// signedRefs = Collections.singletonList(signedRef1);
+ gui.showSecureViewer(signedRefs, returnListener, "return");
+ }
+ };
+
+
+
+// gui.showWelcomeDialog();
+//
+// Thread.sleep(2000);
+//
+// gui.showWaitDialog(null);
+//
+// Thread.sleep(1000);
+//
+// gui.showWaitDialog("test");
+//
+// Thread.sleep(1000);
+//
+//
+// gui.showInsertCardDialog(cancelListener, "cancel");
+//
+// Thread.sleep(2000);
+//
+// gui.showCardNotSupportedDialog(cancelListener, "cancel");
+//
+// Thread.sleep(2000);
+//
+// PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN");
+//
+// gui.showCardPINDialog(cardPinSpec, okListener, "ok", cancelListener, "cancel");
+//
+// Thread.sleep(2000);
+//
+// gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
+//
+// Thread.sleep(4000);
+//
+
+// gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, null, null);
+
+// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
+//
+// Thread.sleep(2000);
+//
+// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}, null, null);
+//
+// Thread.sleep(2000);
+//
+// gui.showErrorDialog("error.test", new Object[] {"Testfehler", "noch ein TestFehler"});
+//
+// Thread.sleep(2000);
+//
+// gui.showErrorDialog("error.no.hashdata", null);
+//
+// Thread.sleep(2000);
+//
+// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"});
+//
+// Thread.sleep(2000);
+//
+// gui.showErrorDialog("error.unknown", null);
+
+ gui.showActivationProgressDialog(1, 3, null, null);
+
+ gui.incrementProgress();
+
+ Thread.sleep(1000);
+
+ gui.incrementProgress();
+
+ Thread.sleep(1000);
+
+ gui.incrementProgress();
+
+
+ Thread.sleep(1000);
+
+ gui.showIdleDialog(null, null);
+
+// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save");
+// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save");
+// Thread.sleep(2000);
+
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+ }
+}
diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml
index 9704b7db..81cb3df8 100644
--- a/BKULocal/pom.xml
+++ b/BKULocal/pom.xml
@@ -93,6 +93,21 @@
smccSTAL
1.2.2-SNAPSHOT
+
+ at.gv.egiz
+ BKUGuiExt
+ 1.2.2-SNAPSHOT
+
+
+ at.gv.egiz
+ smccSTALExt
+ 1.2.2-SNAPSHOT
+
+
+ at.gv.egiz
+ BKUViewer
+ 1.2.2-SNAPSHOT
+
BKUHelp
at.gv.egiz
@@ -117,16 +132,6 @@
commons-logging
commons-logging
-
- at.gv.egiz
- BKUApplet
- 1.2.2-SNAPSHOT
-
-
- at.gv.egiz
- BKUViewer
- 1.2.2-SNAPSHOT
-
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/GUIProxy.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/GUIProxy.java
new file mode 100644
index 00000000..38dd04d9
--- /dev/null
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/GUIProxy.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package at.gv.egiz.bku.local.gui;
+
+import at.gv.egiz.bku.gui.BKUGUIFacade;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import javax.swing.JFrame;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class GUIProxy implements InvocationHandler {
+
+ JFrame frame;
+ BKUGUIFacade delegate;
+
+ static public Object newInstance(BKUGUIFacade gui, JFrame frame, Class[] interfaces) {
+ return java.lang.reflect.Proxy.newProxyInstance(gui.getClass().getClassLoader(),
+ interfaces,
+ new GUIProxy(gui, frame));
+ }
+
+ private GUIProxy(BKUGUIFacade delegate, JFrame frame) {
+ this.frame = frame;
+ this.delegate = delegate;
+ }
+
+ @Override
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+
+ if (method.getName().startsWith("show")) {
+ frame.setVisible(true);
+ frame.toFront();
+ return method.invoke(delegate, args);
+ } else { //if (method.getName().startsWith("get")) {
+ return method.invoke(delegate, args);
+ }
+ }
+}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java
deleted file mode 100644
index c724c071..00000000
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package at.gv.egiz.bku.local.stal;
-
-import java.awt.event.ActionListener;
-import java.util.List;
-
-import java.util.Locale;
-import javax.swing.JDialog;
-
-import at.gv.egiz.bku.gui.BKUGUIFacade;
-import at.gv.egiz.smcc.PINSpec;
-import at.gv.egiz.stal.HashDataInput;
-import javax.swing.JFrame;
-
-public class BKUGuiProxy implements BKUGUIFacade {
-
- private BKUGUIFacade delegate;
- private JFrame dialog;
-
- public BKUGuiProxy(JFrame dialog, BKUGUIFacade delegate) {
- this.delegate = delegate;
- this.dialog = dialog;
- }
-
- private void showDialog() {
- dialog.setVisible(true);
- dialog.setAlwaysOnTop(true);
- }
-
- @Override
- public char[] getPin() {
- return delegate.getPin();
- }
-
-// @Override
-// public void init(Container contentPane, Locale locale, URL bgImage, ActionListener helpListener) {
-// delegate.init(contentPane, locale, bgImage, helpListener);
-// }
-
- @Override
- public Locale getLocale() {
- return delegate.getLocale();
- }
-
-// @Override
-// public void showCardNotSupportedDialog(ActionListener cancelListener,
-// String actionCommand) {
-// showDialog();
-// delegate.showCardNotSupportedDialog(cancelListener, actionCommand);
-// }
-//
-// @Override
-// public void showCardPINDialog(PINSpec pinSpec, ActionListener okListener,
-// String okCommand, ActionListener cancelListener, String cancelCommand) {
-// showDialog();
-// delegate.showCardPINDialog(pinSpec, okListener, okCommand, cancelListener,
-// cancelCommand);
-// }
-//
- @Override
- public void showCardPINDialog(PINSpec pinSpec, int numRetries,
- ActionListener okListener, String okCommand,
- ActionListener cancelListener, String cancelCommand) {
- showDialog();
- delegate.showCardPINDialog(pinSpec, numRetries, okListener, okCommand,
- cancelListener, cancelCommand);
- }
-
- @Override
- public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams, ActionListener okListener,
- String actionCommand) {
- showDialog();
- delegate.showErrorDialog(errorMsgKey, errorMsgParams, okListener, actionCommand);
- }
-
- @Override
- public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams) {
- showDialog();
- delegate.showErrorDialog(errorMsgKey, errorMsgParams);
- }
-
-// @Override
-// public void showInsertCardDialog(ActionListener cancelListener,
-// String actionCommand) {
-// showDialog();
-// delegate.showInsertCardDialog(cancelListener, actionCommand);
-// }
-//
-// @Override
-// public void showSignaturePINDialog(PINSpec pinSpec,
-// ActionListener signListener, String signCommand,
-// ActionListener cancelListener, String cancelCommand,
-// ActionListener hashdataListener, String hashdataCommand) {
-// showDialog();
-// delegate.showSignaturePINDialog(pinSpec, signListener, signCommand,
-// cancelListener, cancelCommand, hashdataListener, hashdataCommand);
-// }
-//
- @Override
- public void showSignaturePINDialog(PINSpec pinSpec, int numRetries,
- ActionListener okListener, String okCommand,
- ActionListener cancelListener, String cancelCommand,
- ActionListener hashdataListener, String hashdataCommand) {
- showDialog();
- delegate.showSignaturePINDialog(pinSpec, numRetries, okListener,
- okCommand, cancelListener, cancelCommand, hashdataListener,
- hashdataCommand);
- }
-//
-// @Override
-// public void showWaitDialog(String waitMessage) {
-// showDialog();
-// delegate.showWaitDialog(waitMessage);
-// }
-//
-// @Override
-// public void showWelcomeDialog() {
-// showDialog();
-// delegate.showWelcomeDialog();
-// }
-
- @Override
- public void showSecureViewer(List signedReferences,
- ActionListener okListener,
- String okCommand) {
- showDialog();
- delegate.showSecureViewer(signedReferences, okListener, okCommand);
- }
-
- @Override
- public void showMessageDialog(String titleKey,
- String msgKey, Object[] msgParams,
- String buttonKey, ActionListener okListener, String okCommand) {
- showDialog();
- delegate.showMessageDialog(titleKey, msgKey, msgParams, buttonKey, okListener, okCommand);
- }
-
- @Override
- public void showMessageDialog(String titleKey, String msgKey, Object[] msgParams) {
- showDialog();
- delegate.showMessageDialog(titleKey, msgKey, msgParams);
- }
-
- @Override
- public void showMessageDialog(String titleKey, String msgKey) {
- showDialog();
- delegate.showMessageDialog(titleKey, msgKey);
- }
-
- @Override
- public void showPinpadSignaturePINDialog(PINSpec pinSpec, int numRetries,
- ActionListener viewerListener, String viewerCommand) {
- showDialog();
- delegate.showPinpadSignaturePINDialog(pinSpec, numRetries,
- viewerListener, viewerCommand);
- }
-}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java
index ca4d35d1..75f71be6 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java
@@ -18,11 +18,13 @@ package at.gv.egiz.bku.local.stal;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.smccstal.AbstractBKUWorker;
+import at.gv.egiz.bku.smccstal.PINManagementRequestHandler;
import at.gv.egiz.stal.QuitRequest;
import at.gv.egiz.stal.STALRequest;
import at.gv.egiz.stal.STALResponse;
import at.gv.egiz.stal.SignRequest;
+import at.gv.egiz.stal.ext.PINManagementRequest;
import java.util.List;
import javax.swing.JFrame;
@@ -39,16 +41,18 @@ public class LocalBKUWorker extends AbstractBKUWorker {
this.container = container;
addRequestHandler(SignRequest.class,
new LocalSignRequestHandler(new LocalSecureViewer(gui)));
+ addRequestHandler(PINManagementRequest.class, new PINManagementRequestHandler());
}
+ /** does not change container's visibility (use quit request to close) */
@Override
public List handleRequest(List extends STALRequest> requestList) {
signatureCard = null;
List responses = super.handleRequest(requestList);
- // container.setVisible(false);
return responses;
}
+ /** overrides handle quit from abstract bku worker, make container invisible */
@Override
public STALResponse handleRequest(STALRequest request) {
if (request instanceof QuitRequest) {
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java
index 4c9554e2..712fb969 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSTALFactory.java
@@ -24,6 +24,9 @@ import java.util.Locale;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.gui.BKUGUIImpl;
+import at.gv.egiz.bku.gui.PINManagementGUI;
+import at.gv.egiz.bku.gui.PINManagementGUIFacade;
+import at.gv.egiz.bku.local.gui.GUIProxy;
import at.gv.egiz.bku.local.gui.LocalHelpListener;
import at.gv.egiz.stal.STAL;
import at.gv.egiz.stal.STALFactory;
@@ -33,10 +36,16 @@ import javax.swing.JRootPane;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+/**
+ * Creates a PINManagementGUI and a LocalBKUWorker, which in turn registers
+ * PINManagementRequestHandler from smccSTALExt.
+ * The RequestHandler expects PINManagementGUIFacade, therefore BKUGUIProxy has to implement the extended GUI.
+ * @author clemens
+ */
public class LocalSTALFactory implements STALFactory {
protected static final Log log = LogFactory.getLog(LocalSTALFactory.class);
- protected static final Dimension PREFERRED_SIZE = new Dimension(300, 189);
+ protected static final Dimension PREFERRED_SIZE = new Dimension(318, 200);
protected String helpURL;
protected Locale locale;
@@ -47,7 +56,7 @@ public class LocalSTALFactory implements STALFactory {
//http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html
// use undecorated JFrame instead of JWindow,
// which creates an invisible owning frame and therefore cannot getFocusInWindow()
- JFrame dialog = new JFrame();
+ JFrame dialog = new JFrame("Bürgerkarte");
dialog.setUndecorated(true);
dialog.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
@@ -64,12 +73,13 @@ public class LocalSTALFactory implements STALFactory {
} catch (MalformedURLException ex) {
log.error("failed to configure help listener: " + ex.getMessage(), ex);
}
- BKUGUIFacade gui = new BKUGUIImpl(dialog.getContentPane(),
+ PINManagementGUIFacade gui = new PINManagementGUI(dialog.getContentPane(),
dialog.getLocale(),
BKUGUIFacade.Style.advanced,
null,
helpListener);
- stal = new LocalBKUWorker(new BKUGuiProxy(dialog, gui), dialog);
+ BKUGUIFacade proxy = (BKUGUIFacade) GUIProxy.newInstance(gui, dialog, new Class[] { PINManagementGUIFacade.class} );
+ stal = new LocalBKUWorker(proxy, dialog);
dialog.setPreferredSize(PREFERRED_SIZE);
dialog.pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/PINManagementServlet.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/PINManagementServlet.java
new file mode 100644
index 00000000..89e526ac
--- /dev/null
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/PINManagementServlet.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package at.gv.egiz.bku.local.webapp;
+
+import at.gv.egiz.bku.local.stal.LocalSTALFactory;
+import at.gv.egiz.marshal.MarshallerFactory;
+import at.gv.egiz.stal.QuitRequest;
+import at.gv.egiz.stal.STALRequest;
+import at.gv.egiz.stal.STALResponse;
+import at.gv.egiz.stal.ext.PINManagementRequest;
+import at.gv.egiz.stal.ext.PINManagementResponse;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import org.apache.regexp.REUtil;
+
+/**
+ * PINManagementBKUWorker for non-applet version
+ * @author Clemens Orthacker
+ */
+public class PINManagementServlet extends HttpServlet {
+
+// static JAXBContext stalCtx;
+
+ /**
+ * Processes requests for both HTTP GET
and POST
methods.
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+
+ LocalSTALFactory sf = new LocalSTALFactory();
+
+ ArrayList stalReqs = new ArrayList();
+ stalReqs.add(new PINManagementRequest());
+ stalReqs.add(new QuitRequest());
+
+ List stalResps = sf.createSTAL().handleRequest(stalReqs);
+
+ String redirect = request.getParameter("redirect");
+ if (redirect != null) {
+ String referer = request.getHeader("Referer");
+ if (referer != null) {
+ redirect = new URL(new URL(referer), redirect).toExternalForm();
+ }
+ response.sendRedirect(redirect);
+ } else {
+ response.setStatus(HttpServletResponse.SC_OK);
+// if (stalResps.get(0) != null) {
+// PrintWriter out = response.getWriter();
+// try {
+// response.setContentType("text/xml;charset=UTF-8");
+// // cannot directly marshal STALResponse, no ObjectFactory in at.gv.egiz.stal
+// if (stalCtx == null) {
+// stalCtx = JAXBContext.newInstance("at.gv.egiz.stal:at.gv.egiz.stal.ext");
+// }
+// Marshaller m = MarshallerFactory.createMarshaller(stalCtx);
+// m.marshal(stalResps.get(0), out);
+// out.close();
+// } catch (JAXBException ex) {
+// throw new ServletException("Failed to marshal STAL response", ex);
+// } finally {
+// out.close();
+// }
+// } else {
+// throw new ServletException("internal error");
+// }
+ }
+
+
+// try {
+// out.println("");
+// out.println("");
+// out.println("Servlet PINManagementServlet");
+// out.println("");
+// out.println("");
+// out.println("Servlet PINManagementServlet at " + request.getContextPath() + "
");
+// out.println("" + stalResps.size() + " responses:
");
+// for (STALResponse resp : stalResps) {
+// out.println(" - " + resp.getClass());
+// }
+// Enumeration headers = request.getHeaderNames();
+// out.println("
headers:
");
+// while (headers.hasMoreElements()) {
+// String header = headers.nextElement();
+// out.println("- " + header + ": " + request.getHeader(header));
+// }
+// Enumeration params = request.getParameterNames();
+// out.println("
params:
");
+// while (params.hasMoreElements()) {
+// String param = params.nextElement();
+// out.println("- " + param + ": " + request.getParameter(param));
+// }
+// out.println("
");
+// out.println("");
+// } finally {
+// out.close();
+// }
+ }
+
+ //
+ /**
+ * Handles the HTTP GET
method.
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Handles the HTTP POST
method.
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Returns a short description of the servlet.
+ * @return a String containing servlet description
+ */
+ @Override
+ public String getServletInfo() {
+ return "Short description";
+ }//
+}
diff --git a/BKULocal/src/main/webapp/WEB-INF/web.xml b/BKULocal/src/main/webapp/WEB-INF/web.xml
index 8e696570..83f33d9e 100644
--- a/BKULocal/src/main/webapp/WEB-INF/web.xml
+++ b/BKULocal/src/main/webapp/WEB-INF/web.xml
@@ -40,6 +40,10 @@
help
/help.jsp
+
+ PINManagementServlet
+ at.gv.egiz.bku.local.webapp.PINManagementServlet
+
BKUServlet
/http-security-layer-request
@@ -53,7 +57,11 @@
/help/*
-
+
+
+ PINManagementServlet
+ /PINManagement
+
index.html
index.htm
diff --git a/BKULocal/src/main/webapp/index.html b/BKULocal/src/main/webapp/index.html
index 215eec80..537c154a 100644
--- a/BKULocal/src/main/webapp/index.html
+++ b/BKULocal/src/main/webapp/index.html
@@ -23,7 +23,12 @@
BKU Web Start - Willkommen
- Diese Seite installiert das MOCCA Zertifikat in ihrem Browser.
+
+
Diese Seite installiert das MOCCA Zertifikat in ihrem Browser.
In jedem weiteren Browser können sie dieses durch Aufruf dieser Seite ebenso installieren.
+
+