From 32d17447a258188b2d534bcb0bf65a659ba7b7d0 Mon Sep 17 00:00:00 2001
From: mcentner
Date: Fri, 29 Aug 2008 12:11:34 +0000
Subject: Initial import.
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 53 ++++++++
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 136 +++++++++++++++++++++
2 files changed, 189 insertions(+)
create mode 100644 BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
create mode 100644 BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
new file mode 100644
index 00000000..4dc1f8b3
--- /dev/null
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
@@ -0,0 +1,53 @@
+/*
+* 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 javax.swing.JFrame;
+import org.junit.Ignore;
+import org.junit.Test;
+
+
+/**
+ *
+ * @author clemens
+ */
+public class BKUGUITest {
+
+ @Ignore
+ public void testBKUGUI() {
+ JFrame testFrame = new JFrame("BKUGUITest");
+ BKUGUI gui = new BKUGUI();
+ gui.init(testFrame.getContentPane(), 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() {
+ }
+}
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
new file mode 100644
index 00000000..50771216
--- /dev/null
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -0,0 +1,136 @@
+/*
+* 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 java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.Collections;
+
+/**
+ *
+ * @author clemens
+ */
+public class BKUGUIWorker implements Runnable {
+
+ BKUGUIFacade gui;
+
+ public void init(BKUGUIFacade gui) {
+ this.gui = gui;
+ }
+
+ @Override
+ public void run() {
+ try {
+
+ final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN");
+
+
+ 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, signListener, "sign", cancelListener, "cancel", null, "hashdata");
+ }
+ };
+ HashDataInput signedRef = new HashDataInput() {
+
+ @Override
+ public InputStream getHashDataInput() {
+ return new ByteArrayInputStream("HashDataInput_002 ".getBytes());
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/xml";
+ }
+ };
+ gui.showHashDataInputDialog(Collections.singletonList(signedRef), returnListener, "return");
+ }
+ };
+
+
+
+// gui.showWelcomeDialog();
+//
+// Thread.sleep(2000);
+
+ 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(2000);
+//
+// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
+//
+// Thread.sleep(2000);
+////
+// gui.showErrorDialog("Testfehler occured", null, null);
+//
+// Thread.sleep(2000);
+//
+// gui.showErrorDialog("Testfehler occured");
+
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+ }
+}
--
cgit v1.2.3
From 3808a5b4ec9d13c8cbb1b7fd95afa62c133342fd Mon Sep 17 00:00:00 2001
From: clemenso
Date: Fri, 5 Sep 2008 13:39:14 +0000
Subject: HashDataInput
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@21 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
BKUCommonGUI/pom.xml | 32 +-
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 432 +++++++++++----------
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 17 +-
.../java/at/gv/egiz/bku/gui/HashDataInput.java | 36 --
.../at/gv/egiz/bku/gui/Messages.properties | 8 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 8 +-
6 files changed, 258 insertions(+), 275 deletions(-)
delete mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataInput.java
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUCommonGUI/pom.xml b/BKUCommonGUI/pom.xml
index bd579c51..8c08ba6e 100644
--- a/BKUCommonGUI/pom.xml
+++ b/BKUCommonGUI/pom.xml
@@ -1,6 +1,5 @@
-
+
bku
at.gv.egiz
@@ -11,23 +10,28 @@
BKUCommonGUI
BKU Common GUI
1.0-SNAPSHOT
-
at.gv.egiz
smcc
1.0-SNAPSHOT
+
+ at.gv.egiz
+ STAL
+ 1.0-SNAPSHOT
+ compile
+
-
-
\ No newline at end of file
+
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
index 87b4eab4..0ad09c70 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
@@ -1,19 +1,19 @@
/*
-* 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.
-*/
+ * 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.
@@ -21,6 +21,7 @@
package at.gv.egiz.bku.gui;
import at.gv.egiz.smcc.PINSpec;
+import at.gv.egiz.stal.HashDataInput;
import java.awt.Color;
import java.awt.Container;
import java.awt.Cursor;
@@ -30,7 +31,6 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.BufferedOutputStream;
import java.io.File;
-import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -38,16 +38,14 @@ import java.text.MessageFormat;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
-import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
+import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.LayoutStyle;
@@ -56,22 +54,23 @@ import javax.swing.filechooser.FileFilter;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
*
* @author clemens
*/
public class BKUGUI implements BKUGUIFacade {
-
+
+ private static final Log log = LogFactory.getLog(BKUGUI.class);
public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages";
public static final String LOGO_RESOURCE = "/images/logo.png";
-
public static final int MAIN_PANEL_WIDTH = 100;
// public static final int MAIN_PANEL_HEIGHT = 20;
public static final int PREF_SIZE_PINFIELD = 118;
public static final Color ERROR_COLOR = Color.RED;
public static final Color HYPERLINK_COLOR = Color.BLUE;
-
private static final String TITLE_WELCOME = "title.welcome";
private static final String TITLE_INSERTCARD = "title.insertcard";
private static final String TITLE_CARD_NOT_SUPPORTED = "title.cardnotsupported";
@@ -79,30 +78,32 @@ public class BKUGUI implements BKUGUIFacade {
private static final String TITLE_SIGN = "title.sign";
private static final String TITLE_ERROR = "title.error";
private static final String TITLE_RETRY = "title.retry";
+ private static final String TITLE_WAIT = "title.wait";
+ private static final String TITLE_HASHDATA = "title.hashdata";
private static final String WINDOWTITLE_SAVE = "windowtitle.save";
-
- private static final String MESSAGE_WAIT="message.wait";
- private static final String MESSAGE_INSERTCARD="message.insertcard";
- private static final String MESSAGE_HASHDATALINK="message.hashdatalink";
- private static final String MESSAGE_RETRIES="message.retries";
- private static final String LABEL_PIN="label.pin";
- private static final String LABEL_PINSIZE="label.pinsize";
+ private static final String WINDOWTITLE_OVERWRITE = "windowtitle.overwrite";
+ private static final String MESSAGE_WAIT = "message.wait";
+ private static final String MESSAGE_INSERTCARD = "message.insertcard";
+ private static final String MESSAGE_HASHDATALINK = "message.hashdatalink";
+ private static final String MESSAGE_HASHDATA = "message.hashdata";
+ private static final String MESSAGE_RETRIES = "message.retries";
+ private static final String MESSAGE_OVERWRITE = "message.overwrite";
+ private static final String LABEL_PIN = "label.pin";
+ private static final String LABEL_PINSIZE = "label.pinsize";
// private static final String LABEL_CARDPINSIZE="label.cardpinsize";
// private static final String LABEL_SIGNPIN="label.signpin";
// private static final String LABEL_SIGNPINSIZE="label.signpinsize";
private static final String BUTTON_OK = "button.ok";
private static final String BUTTON_CANCEL = "button.cancel";
private static final String BUTTON_SIGN = "button.sign";
-
+ private static final String BUTTON_SAVE = "button.save";
private static final String MIMETYPE_DESC_XML = "mimetype.desc.xml";
private static final String MIMETYPE_DESC_TXT = "mimetype.desc.txt";
private static final String MIMETYPE_DESC_PDF = "mimetype.desc.pdf";
private static final String MIMETYPE_DESC_BIN = "mimetype.desc.bin";
private static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix";
-
protected Container contentPane;
protected ResourceBundle messages;
-
/** left and right side main panels */
protected JPanel iconPanel;
protected JPanel contentPanel;
@@ -121,7 +122,7 @@ public class BKUGUI implements BKUGUIFacade {
*/
@Override
public void init(final Container contentPane, String localeString) {
-
+
if (localeString != null) {
messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString));
} else {
@@ -174,18 +175,17 @@ public class BKUGUI implements BKUGUIFacade {
// headerPanel.setBorder(new TitledBorder("header"));
// mainPanel.setBorder(new TitledBorder("main"));
// buttonPanel.setBorder(new TitledBorder("button"));
-
+
titleLabel = new JLabel();
- titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() |
- java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2));
+ titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() |
+ java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2));
// titleLabel.setForeground(defaultForground);
-
+
GroupLayout headerPanelLayout = new GroupLayout(headerPanel);
headerPanel.setLayout(headerPanelLayout);
-
+
headerPanelLayout.setHorizontalGroup(
- headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(titleLabel, GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE));
+ headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(titleLabel, GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE));
headerPanelLayout.setVerticalGroup(
headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(titleLabel));
@@ -194,25 +194,12 @@ public class BKUGUI implements BKUGUIFacade {
GroupLayout contentPanelLayout = new GroupLayout(contentPanel);
contentPanel.setLayout(contentPanelLayout);
contentPanelLayout.setHorizontalGroup(
- contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(headerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(mainPanel, GroupLayout.DEFAULT_SIZE, MAIN_PANEL_WIDTH, Short.MAX_VALUE)
- .addComponent(buttonPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))));
+ contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(contentPanelLayout.createSequentialGroup().addContainerGap().addGroup(contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(headerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(mainPanel, GroupLayout.DEFAULT_SIZE, MAIN_PANEL_WIDTH, Short.MAX_VALUE).addComponent(buttonPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))));
contentPanelLayout.setVerticalGroup(
- contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addContainerGap()
- .addComponent(headerPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(mainPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) //79, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(buttonPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addContainerGap()));
+ contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(contentPanelLayout.createSequentialGroup().addContainerGap().addComponent(headerPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(mainPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) //79, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(buttonPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addContainerGap()));
}
-
+
@Override
public void showLoginDialog(ActionListener loginListener, String actionCommand) {
SwingUtilities.invokeLater(new Runnable() {
@@ -220,13 +207,13 @@ public class BKUGUI implements BKUGUIFacade {
public void run() {
mainPanel.removeAll();
buttonPanel.removeAll();
-
+
titleLabel.setText(messages.getString(TITLE_ERROR));
// titleLabel.setForeground(defaultForground);
-
+
JLabel waitMsgLabel = new JLabel();
waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- waitMsgLabel.setText("LoginDialog not supported yet.");
+ waitMsgLabel.setText("LoginDialog not supported yet.");
waitMsgLabel.setForeground(ERROR_COLOR);
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
@@ -236,12 +223,12 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel));
-
+
contentPanel.validate();
}
});
}
-
+
@Override
public void showWelcomeDialog() {
SwingUtilities.invokeLater(new Runnable() {
@@ -249,13 +236,13 @@ public class BKUGUI implements BKUGUIFacade {
public void run() {
mainPanel.removeAll();
buttonPanel.removeAll();
-
- titleLabel.setText(messages.getString(TITLE_WELCOME));
+
+ titleLabel.setText(messages.getString(TITLE_WELCOME));
// titleLabel.setForeground(defaultForground);
-
+
JLabel waitMsgLabel = new JLabel();
waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- waitMsgLabel.setText(messages.getString(MESSAGE_WAIT));
+ waitMsgLabel.setText(messages.getString(MESSAGE_WAIT));
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
@@ -264,9 +251,9 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel));
-
+
contentPanel.validate();
-
+
}
});
}
@@ -278,13 +265,13 @@ public class BKUGUI implements BKUGUIFacade {
public void run() {
mainPanel.removeAll();
buttonPanel.removeAll();
-
- titleLabel.setText(messages.getString(TITLE_INSERTCARD));
+
+ titleLabel.setText(messages.getString(TITLE_INSERTCARD));
// titleLabel.setForeground(defaultForground);
-
+
JButton cancelButton = new JButton();
cancelButton.setFont(cancelButton.getFont());
- cancelButton.setText(messages.getString(BUTTON_CANCEL));
+ cancelButton.setText(messages.getString(BUTTON_CANCEL));
cancelButton.addActionListener(cancelListener);
cancelButton.setActionCommand(cancelCommand);
@@ -292,15 +279,10 @@ public class BKUGUI implements BKUGUIFacade {
buttonPanel.setLayout(buttonPanelLayout);
buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
- .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(cancelButton)
- .addContainerGap()));
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(cancelButton).addContainerGap()));
buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(cancelButton));
-
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(cancelButton));
+
contentPanel.validate();
}
});
@@ -313,19 +295,19 @@ public class BKUGUI implements BKUGUIFacade {
public void run() {
mainPanel.removeAll();
buttonPanel.removeAll();
-
+
titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED));
// titleLabel.setForeground(defaultForground);
-
+
JButton cancelButton = new JButton();
cancelButton.setFont(cancelButton.getFont());
cancelButton.setText(messages.getString(BUTTON_CANCEL));
cancelButton.addActionListener(cancelListener);
cancelButton.setActionCommand(cancelCommand);
-
+
JLabel errorMsgLabel = new JLabel();
errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- errorMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD));
+ errorMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD));
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
@@ -334,21 +316,16 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel));
-
-
+
+
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
- .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(cancelButton)
- .addContainerGap()));
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(cancelButton).addContainerGap()));
buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(cancelButton));
-
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(cancelButton));
+
contentPanel.validate();
}
});
@@ -361,10 +338,10 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-
+
if (numRetries < 0) {
String cardpinTitle = messages.getString(TITLE_CARDPIN);
- titleLabel.setText(MessageFormat.format(cardpinTitle, new Object[] {pinSpec.getLocalizedName()}));
+ titleLabel.setText(MessageFormat.format(cardpinTitle, new Object[]{pinSpec.getLocalizedName()}));
} else {
titleLabel.setText(messages.getString(TITLE_RETRY));
}
@@ -381,11 +358,11 @@ public class BKUGUI implements BKUGUIFacade {
okButton.setText(messages.getString(BUTTON_OK));
okButton.setActionCommand(okCommand);
okButton.addActionListener(okListener);
-
+
JLabel cardPinLabel = new JLabel();
cardPinLabel.setFont(cardPinLabel.getFont().deriveFont(cardPinLabel.getFont().getStyle() | java.awt.Font.BOLD));
- String pinLabel = messages.getString(LABEL_PIN);
- cardPinLabel.setText(MessageFormat.format(pinLabel, new Object[] {pinSpec.getLocalizedName()}));
+ String pinLabel = messages.getString(LABEL_PIN);
+ cardPinLabel.setText(MessageFormat.format(pinLabel, new Object[]{pinSpec.getLocalizedName()}));
// JPasswordField cardPINField = new JPasswordField();
pinField = new JPasswordField();
@@ -410,9 +387,9 @@ public class BKUGUI implements BKUGUIFacade {
if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
pinSize += "-" + pinSpec.getMaxLength();
}
- infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[] {pinSize}));
- } else {
- infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[] {String.valueOf(numRetries)}));
+ infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize}));
+ } else {
+ infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)}));
infoLabel.setForeground(ERROR_COLOR);
}
@@ -422,7 +399,7 @@ public class BKUGUI implements BKUGUIFacade {
// GroupLayout.ParallelGroup mainGroup = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
// mainGroup.addComponent(pinSizeLabel) //, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)
// .addComponent(pinField, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE);
-
+
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup() // .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
// .addComponent(hashDataLabel)
@@ -434,9 +411,7 @@ public class BKUGUI implements BKUGUIFacade {
.addContainerGap()));
mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addContainerGap() // .addComponent(hashDataLabel).addGap(14, 14, 14)
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addContainerGap() // .addComponent(hashDataLabel).addGap(14, 14, 14)
.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) //, false)
.addComponent(cardPinLabel) //, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
.addComponent(pinField)) //, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
@@ -446,18 +421,13 @@ public class BKUGUI implements BKUGUIFacade {
buttonPanel.setLayout(buttonPanelLayout);
buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
- .addContainerGap(15, Short.MAX_VALUE)
- .addComponent(okButton)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(cancelButton).addContainerGap()));
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE).addComponent(okButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton).addContainerGap()));
buttonPanelLayout.setVerticalGroup(
buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(okButton).addComponent(cancelButton)));
-
+
pinField.requestFocusInWindow();
contentPanel.validate();
-
+
}
});
}
@@ -471,7 +441,7 @@ public class BKUGUI implements BKUGUIFacade {
public void showCardPINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand) {
showCardPINDialog(pinSpec, numRetries, okListener, okCommand, cancelListener, cancelCommand);
}
-
+
@Override
public void showSignaturePINDialog(PINSpec pinSpec, ActionListener signListener, String signCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand) {
showSignaturePINDialog(pinSpec, -1, signListener, signCommand, cancelListener, cancelCommand, hashdataListener, hashdataCommand);
@@ -482,15 +452,13 @@ public class BKUGUI implements BKUGUIFacade {
showSignaturePINDialog(pinSpec, numRetries, okListener, okCommand, cancelListener, cancelCommand, hashdataListener, hashdataCommand);
}
-
-
private void showSignaturePINDialog(final PINSpec pinSpec, final int numRetries, final ActionListener signListener, final String signCommand, final ActionListener cancelListener, final String cancelCommand, final ActionListener hashdataListener, final String hashdataCommand) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
mainPanel.removeAll();
buttonPanel.removeAll();
-
+
if (numRetries < 0) {
titleLabel.setText(messages.getString(TITLE_SIGN));
} else {
@@ -512,8 +480,8 @@ public class BKUGUI implements BKUGUIFacade {
JLabel signPinLabel = new JLabel();
signPinLabel.setFont(signPinLabel.getFont().deriveFont(signPinLabel.getFont().getStyle() | java.awt.Font.BOLD));
- String pinLabel = messages.getString(LABEL_PIN);
- signPinLabel.setText(MessageFormat.format(pinLabel, new Object[] {pinSpec.getLocalizedName()}));
+ String pinLabel = messages.getString(LABEL_PIN);
+ signPinLabel.setText(MessageFormat.format(pinLabel, new Object[]{pinSpec.getLocalizedName()}));
pinField = new JPasswordField();
pinField.setText("");
@@ -538,25 +506,26 @@ public class BKUGUI implements BKUGUIFacade {
if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
pinSize += "-" + pinSpec.getMaxLength();
}
- infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[] {pinSize}));
+ infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize}));
} else {
- infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[] {String.valueOf(numRetries)}));
+ infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)}));
infoLabel.setForeground(ERROR_COLOR);
}
-
+
JLabel hashDataLabel = new JLabel();
hashDataLabel.setFont(hashDataLabel.getFont().deriveFont(hashDataLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
hashDataLabel.setText(messages.getString(MESSAGE_HASHDATALINK));
hashDataLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
hashDataLabel.setForeground(HYPERLINK_COLOR);
hashDataLabel.addMouseListener(new MouseAdapter() {
+
@Override
- public void mouseClicked(MouseEvent me) {
+ public void mouseClicked(MouseEvent me) {
ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand);
hashdataListener.actionPerformed(e);
}
});
-
+
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
@@ -580,10 +549,8 @@ public class BKUGUI implements BKUGUIFacade {
pinField.requestFocusInWindow();
contentPanel.validate();
-
- }
-// private ParallelGroup createMainGroup(GroupLayout mainPanelLayout, JLabel hashDataLabel, JLabel signPinLabel, JLabel pinSizeLabel, JLabel errorLabel) {
+ }// private ParallelGroup createMainGroup(GroupLayout mainPanelLayout, JLabel hashDataLabel, JLabel signPinLabel, JLabel pinSizeLabel, JLabel errorLabel) {
// ParallelGroup mainGroup = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
// mainGroup.addComponent(hashDataLabel);
// if (errorLabel != null) {
@@ -597,7 +564,6 @@ public class BKUGUI implements BKUGUIFacade {
// .addComponent(pinField, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)));
// return mainGroup;
// }
-
// private GroupLayout.SequentialGroup createVerticalMainGroup(GroupLayout mainPanelLayout, JLabel hashDataLabel, JLabel signPinLabel, JLabel pinSizeLabel, JLabel errorLabel) {
// GroupLayout.SequentialGroup mainGroup = mainPanelLayout.createSequentialGroup();
// mainGroup.addComponent(hashDataLabel)
@@ -637,8 +603,8 @@ public class BKUGUI implements BKUGUIFacade {
public void run() {
mainPanel.removeAll();
buttonPanel.removeAll();
-
- titleLabel.setText(messages.getString(TITLE_ERROR));
+
+ titleLabel.setText(messages.getString(TITLE_ERROR));
// titleLabel.setForeground(defaultForground);
JLabel errorMsgLabel = new JLabel();
@@ -653,7 +619,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel));
-
+
JButton okButton = new JButton();
okButton.setFont(okButton.getFont());
okButton.setText(messages.getString(BUTTON_OK));
@@ -664,15 +630,10 @@ public class BKUGUI implements BKUGUIFacade {
buttonPanel.setLayout(buttonPanelLayout);
buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
- .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(okButton)
- .addContainerGap()));
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(okButton).addContainerGap()));
buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(okButton));
-
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(okButton));
+
contentPanel.validate();
}
});
@@ -685,13 +646,13 @@ public class BKUGUI implements BKUGUIFacade {
public void run() {
mainPanel.removeAll();
buttonPanel.removeAll();
-
- titleLabel.setText(messages.getString(TITLE_ERROR));
+
+ titleLabel.setText(messages.getString(TITLE_ERROR));
// titleLabel.setForeground(defaultForground);
JLabel errorMsgLabel = new JLabel();
errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- errorMsgLabel.setText("" + errorMsg + "");
+ errorMsgLabel.setText("" + errorMsg + "");
errorMsgLabel.setForeground(ERROR_COLOR);
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
@@ -701,69 +662,37 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel));
-
+
contentPanel.validate();
}
});
}
-
+
@Override
public void showHashDataInputDialog(final List signedReferences, final ActionListener okListener, final String okCommand) {
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
-
+
if (signedReferences != null && signedReferences.size() == 1) {
- FileOutputStream fos = null;
- try {
- HashDataInput signedRef = signedReferences.get(0);
- final String mimeType = signedRef.getMimeType();
- String dir = System.getProperty("user.home");
- JFileChooser fileDialog = new JFileChooser(dir);
- fileDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
- fileDialog.setMultiSelectionEnabled(false);
- fileDialog.setDialogTitle(messages.getString(WINDOWTITLE_SAVE));
- fileDialog.setDialogType(JFileChooser.SAVE_DIALOG);
- fileDialog.setFileHidingEnabled(true);
- MimeFilter mimeFilter = new MimeFilter(mimeType);
- fileDialog.setFileFilter(mimeFilter);
- String filename = messages.getString(SAVE_HASHDATAINPUT_PREFIX) + mimeFilter.getExtension();
- fileDialog.setSelectedFile(new File(dir, filename));
- switch (fileDialog.showSaveDialog(contentPane)) {
- case JFileChooser.APPROVE_OPTION:
- File f = fileDialog.getSelectedFile();
-// if (f.exists()) {
-// //TODO
-// }
-
- fos = new FileOutputStream(f);
- BufferedOutputStream bos = new BufferedOutputStream(fos);
- InputStream hdi = signedRef.getHashDataInput();
- int b;
- while ((b = hdi.read()) != -1) {
- bos.write(b);
- }
- bos.flush();
- bos.close();
- }
- } catch (IOException ex) {
- showErrorDialog("Failed to write signed reference to file: " + ex.getMessage(), null, null);
- ex.printStackTrace();
- } finally {
- try {
- fos.close();
- } catch (IOException ex) {}
- }
+
+ HashDataInput signedRef = signedReferences.get(0);
+// if ("text/plain".equals(signedRef.getMimeType())) {
+// } else {
+ showSaveHashDataInputDialog(signedRef, okListener, okCommand);
+// }
+
} else {
mainPanel.removeAll();
buttonPanel.removeAll();
- titleLabel.setText(messages.getString(TITLE_ERROR));
- // titleLabel.setForeground(defaultForground);
+ titleLabel.setText(messages.getString(TITLE_ERROR));
+ // titleLabel.setForeground(defaultForground);
JLabel errorMsgLabel = new JLabel();
errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- errorMsgLabel.setText("HashDataInputDialog not supported yet.");
+ errorMsgLabel.setText("HashDataInputDialog not supported yet.");
errorMsgLabel.setForeground(ERROR_COLOR);
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
@@ -784,14 +713,9 @@ public class BKUGUI implements BKUGUIFacade {
buttonPanel.setLayout(buttonPanelLayout);
buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
- .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(okButton)
- .addContainerGap()));
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(okButton).addContainerGap()));
buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(okButton));
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(okButton));
contentPanel.validate();
}
@@ -799,13 +723,100 @@ public class BKUGUI implements BKUGUIFacade {
});
}
+
+
+ private void showSaveHashDataInputDialog(HashDataInput signedRef, ActionListener okListener, String okCommand) {
+ String dir = System.getProperty("user.home");
+ JFileChooser fileDialog = new JFileChooser(dir);
+ fileDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
+ fileDialog.setMultiSelectionEnabled(false);
+ fileDialog.setDialogTitle(messages.getString(WINDOWTITLE_SAVE));
+ fileDialog.setDialogType(JFileChooser.SAVE_DIALOG);
+ fileDialog.setFileHidingEnabled(true);
+ MimeFilter mimeFilter = new MimeFilter(signedRef.getMimeType());
+ fileDialog.setFileFilter(mimeFilter);
+ String filename = messages.getString(SAVE_HASHDATAINPUT_PREFIX) + mimeFilter.getExtension();
+ fileDialog.setSelectedFile(new File(dir, filename));
+ switch (fileDialog.showSaveDialog(contentPane)) {
+ case JFileChooser.APPROVE_OPTION:
+ File f = fileDialog.getSelectedFile();
+ if (f.exists()) {
+// log.debug("hashDataInput file exists, overwrite?");
+ String ovrwrt = messages.getString(MESSAGE_OVERWRITE);
+ int overwrite = JOptionPane.showConfirmDialog(contentPane, MessageFormat.format(ovrwrt, filename), messages.getString(WINDOWTITLE_OVERWRITE), JOptionPane.OK_CANCEL_OPTION);
+ if (overwrite != JOptionPane.OK_OPTION) {
+// log.debug("User canceled overwrite HashDataInput, returning to SignaturePin dialog");
+ okListener.actionPerformed(new ActionEvent(fileDialog, ActionEvent.ACTION_PERFORMED, okCommand));
+ return;
+ }
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("Writing HashDataInput " + signedRef.getReferenceId() + " (" + signedRef.getMimeType() + ") to file " + f);
+ }
+ FileOutputStream fos = null;
+ try {
+ fos = new FileOutputStream(f);
+ BufferedOutputStream bos = new BufferedOutputStream(fos);
+ InputStream hdi = signedRef.getHashDataInput();
+ int b;
+ while ((b = hdi.read()) != -1) {
+ bos.write(b);
+ }
+ bos.flush();
+ bos.close();
+ } catch (IOException ex) {
+ log.error("Failed to write HashDataInput to file " + f + ": " + ex.getMessage());
+ showErrorDialog("Failed to write signed reference to file: " + ex.getMessage(), null, null);
+ ex.printStackTrace();
+ } finally {
+ try {
+ fos.close();
+ } catch (IOException ex) {
+ }
+ }
+ }
+ okListener.actionPerformed(new ActionEvent(fileDialog, ActionEvent.ACTION_PERFORMED, okCommand));
+ }
+
+ @Override
+ public void showWaitDialog(final String waitMessage) {
+ SwingUtilities.invokeLater(new Runnable() {
+
+ public void run() {
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
+
+ titleLabel.setText(messages.getString(TITLE_WAIT));
+
+ JLabel waitMsgLabel = new JLabel();
+ waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ if (waitMessage != null) {
+ waitMsgLabel.setText("" + waitMessage + "");
+ } else {
+ waitMsgLabel.setText("" + messages.getString(MESSAGE_WAIT) + "");
+ }
+
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
+
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel));
+
+ contentPanel.validate();
+ }
+ });
+ }
+
@Override
public char[] getPin() {
- if (pinField != null)
+ if (pinField != null) {
return pinField.getPassword();
+ }
return null;
}
-
+
class PINDocument extends PlainDocument {
private PINSpec pinSpec;
@@ -827,7 +838,7 @@ public class BKUGUI implements BKUGUIFacade {
if (pinSpec.getMaxLength() >= (getLength() + str.length())) {
boolean matches = true;
for (int i = 0; i < str.length(); i++) {
- Matcher m = pinPattern.matcher(str.substring(i, i+1));
+ Matcher m = pinPattern.matcher(str.substring(i, i + 1));
if (!m.matches()) {
matches = false;
}
@@ -845,7 +856,7 @@ public class BKUGUI implements BKUGUIFacade {
enterButton.setEnabled(getLength() >= pinSpec.getMinLength());
}
}
-
+
class MimeFilter extends FileFilter {
protected String mimeType;
@@ -853,20 +864,23 @@ public class BKUGUI implements BKUGUIFacade {
public MimeFilter(String mimeType) {
this.mimeType = mimeType;
}
-
+
@Override
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
- } else if ("text/xml".equals(mimeType)) {
- return "xml".equals(getExtension(f));
+ }
+
+ String ext = getExtension(f);
+ if ("text/xml".equals(mimeType)) {
+ return "xml".equals(ext);
} else if ("text/plain".equals(mimeType)) {
- return "txt".equals(getExtension(f));
+ return "txt".equals(ext);
} else if ("application/pdf".equals(mimeType)) {
- return "pdf".equals(getExtension(f));
+ return "pdf".equals(ext);
} else {
- return "bin".equals(getExtension(f));
+ return "bin".equals(ext);
}
}
@@ -875,8 +889,8 @@ public class BKUGUI implements BKUGUIFacade {
String s = f.getName();
int i = s.lastIndexOf('.');
- if (i > 0 && i < s.length() - 1) {
- ext = s.substring(i+1).toLowerCase();
+ if (i > 0 && i < s.length() - 1) {
+ ext = s.substring(i + 1).toLowerCase();
}
return ext;
}
@@ -893,7 +907,7 @@ public class BKUGUI implements BKUGUIFacade {
return messages.getString(MIMETYPE_DESC_BIN);
}
}
-
+
public String getExtension() {
if ("text/xml".equals(mimeType)) {
return ".xml";
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index 3766e905..f8b80556 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -14,23 +14,14 @@
* 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.smcc.PINSpec;
import java.awt.Container;
import java.awt.event.ActionListener;
import java.util.List;
-import javax.swing.JPasswordField;
-/**
- *
- * @author clemens
- */
public interface BKUGUIFacade {
public void init(Container contentPane, String localeString);
@@ -42,7 +33,10 @@ public interface BKUGUIFacade {
* @param loginListener
*/
public void showLoginDialog(ActionListener loginListener, String actionCommand);
-
+
+ /** optional wait message */
+ public void showWaitDialog(String waitMessage);
+
public void showInsertCardDialog(ActionListener cancelListener, String actionCommand);
public void showCardNotSupportedDialog(ActionListener cancelListener, String actionCommand);
@@ -62,5 +56,4 @@ public interface BKUGUIFacade {
public void showErrorDialog(String errorMsg, ActionListener okListener, String actionCommand);
public void showErrorDialog(String errorMsg);
-
}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataInput.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataInput.java
deleted file mode 100644
index d916e81c..00000000
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataInput.java
+++ /dev/null
@@ -1,36 +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.io.InputStream;
-
-/**
- *
- * @author clemens
- */
-public interface HashDataInput {
-
- public InputStream getHashDataInput();
-
- public String getMimeType();
-
-}
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index 62c5a670..21a6bd1b 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -13,8 +13,6 @@
# 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.
title.welcome=Willkommen
title.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken
title.cardnotsupported=Die Karte wird nicht unterst\u00FCtzt
@@ -22,16 +20,22 @@ title.cardpin={0} eingeben
title.sign=Signatur erstellen
title.error=Ein Fehler trat auf
title.retry=Falscher PIN
+title.wait=Bitte warten
+title.hashdata=Signaturdaten
windowtitle.save=Signaturdaten speichern
+windowtitle.overwrite=Datei \u00FCberschreiben?
message.wait=Bitte warten...
message.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken.
message.hashdatalink=Signaturdaten anzeigen...
+message.hashdata=Referenz Id: {0}
message.retries=Noch {0} Versuche
+message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?
label.pin={0}:
label.pinsize=({0} stellig)
button.ok=OK
button.cancel=Abbrechen
button.sign=Signieren
+button.save=Speichern...
mimetype.desc.xml=XML-Dateien (*.xml)
mimetype.desc.txt=Textdateien (*.txt)
mimetype.desc.pdf=Adobe PDF-Dateien (*.pdf)
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index 50771216..a251be55 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -21,10 +21,9 @@
package at.gv.egiz.bku.gui;
import at.gv.egiz.smcc.PINSpec;
+import at.gv.egiz.stal.HashDataInput;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Collections;
@@ -89,6 +88,11 @@ public class BKUGUIWorker implements Runnable {
public String getMimeType() {
return "text/xml";
}
+
+ @Override
+ public String getReferenceId() {
+ return "ref123";
+ }
};
gui.showHashDataInputDialog(Collections.singletonList(signedRef), returnListener, "return");
}
--
cgit v1.2.3
From d3698ed2a4f129e5af970f072bc79bb8226d7765 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Fri, 5 Sep 2008 15:41:19 +0000
Subject: Text HashDataInput
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@24 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 111 ++++++++++++++++++++-
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 34 ++++---
.../stal/service/impl/STALRequestBrokerImpl.java | 2 +-
.../gv/egiz/stal/service/impl/STALServiceImpl.java | 2 +-
.../gv/egiz/bku/smccstal/SignRequestHandler.java | 2 +-
5 files changed, 128 insertions(+), 23 deletions(-)
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
index 0ad09c70..5175b45f 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
@@ -29,15 +29,22 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
+import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
import java.text.MessageFormat;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.GroupLayout;
@@ -48,6 +55,8 @@ import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
import javax.swing.LayoutStyle;
import javax.swing.SwingUtilities;
import javax.swing.filechooser.FileFilter;
@@ -677,11 +686,44 @@ public class BKUGUI implements BKUGUIFacade {
if (signedReferences != null && signedReferences.size() == 1) {
- HashDataInput signedRef = signedReferences.get(0);
-// if ("text/plain".equals(signedRef.getMimeType())) {
-// } else {
+ final HashDataInput signedRef = signedReferences.get(0);
+ if ("text/plain".equals(signedRef.getMimeType())) {
+ //TODO get encoding from mimetype
+ //read directly to byte[] since hashDataIS is backed by byte[] ?
+ ByteArrayOutputStream baos = null;
+ try {
+ String refId = signedRef.getReferenceId();
+ InputStream hashDataIS = signedRef.getHashDataInput();
+ if (hashDataIS == null) {
+ showErrorDialog("Failed to obtain HashDataInput for reference " + refId, okListener, okCommand);
+ } else {
+ baos = new ByteArrayOutputStream(hashDataIS.available());
+ int c;
+ while ((c = hashDataIS.read()) != -1) {
+ baos.write(c);
+ }
+ String text = baos.toString("UTF-8");
+
+ ActionListener al = new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ showSaveHashDataInputDialog(signedRef, okListener, okCommand);
+ }
+ };
+ showPlainTextHashDataInputDialog(text, refId, okListener, okCommand, al, "save");
+ }
+ } catch (IOException ex) {
+ showErrorDialog("Failed to read HashDataInput for reference " + signedRef.getReferenceId() + ": " + ex.getMessage(), okListener, okCommand);
+ } finally {
+ try {
+ baos.close();
+ } catch (IOException ex) {
+ }
+ }
+ } else {
showSaveHashDataInputDialog(signedRef, okListener, okCommand);
-// }
+ }
} else {
mainPanel.removeAll();
@@ -723,7 +765,66 @@ public class BKUGUI implements BKUGUIFacade {
});
}
-
+ private void showPlainTextHashDataInputDialog(String text, String refId, ActionListener cancelListener, String cancelCommand, ActionListener saveListener, String saveCommand) {
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
+
+ titleLabel.setText(messages.getString(TITLE_HASHDATA));
+
+ JLabel refIdLabel = new JLabel();
+ refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ String refIdLabelPattern = messages.getString(MESSAGE_HASHDATA);
+ refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[] {refId} ));
+
+ JScrollPane hashDataScrollPane = new JScrollPane();
+ JTextArea hashDataTextArea = new JTextArea(text);
+ hashDataTextArea.setEditable(false);
+ hashDataTextArea.setColumns(20);
+ hashDataTextArea.setRows(3);
+ hashDataScrollPane.setViewportView(hashDataTextArea);
+
+
+ JButton cancelButton = new JButton();
+ cancelButton.setFont(cancelButton.getFont());
+ cancelButton.setText(messages.getString(BUTTON_CANCEL));
+ cancelButton.setActionCommand(cancelCommand);
+ cancelButton.addActionListener(cancelListener);
+
+ JButton saveButton = new JButton();
+ saveButton.setFont(saveButton.getFont());
+ saveButton.setText(messages.getString(BUTTON_SAVE));
+ saveButton.setActionCommand(saveCommand);
+ saveButton.addActionListener(saveListener);
+
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
+
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(refIdLabel)
+ .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE))
+ .addContainerGap()));
+
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addComponent(refIdLabel)
+ .addGap(refIdLabel.getFont().getSize())
+ .addComponent(hashDataScrollPane)
+ .addGap(refIdLabel.getFont().getSize())));
+
+ GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+ buttonPanel.setLayout(buttonPanelLayout);
+
+ buttonPanelLayout.setHorizontalGroup(
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE).addComponent(saveButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton).addContainerGap()));
+ buttonPanelLayout.setVerticalGroup(
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(saveButton).addComponent(cancelButton)));
+
+ contentPanel.validate();
+ }
private void showSaveHashDataInputDialog(HashDataInput signedRef, ActionListener okListener, String okCommand) {
String dir = System.getProperty("user.home");
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index a251be55..e2f478c9 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -86,7 +86,7 @@ public class BKUGUIWorker implements Runnable {
@Override
public String getMimeType() {
- return "text/xml";
+ return "text/plain";
}
@Override
@@ -104,13 +104,13 @@ public class BKUGUIWorker implements Runnable {
//
// Thread.sleep(2000);
- gui.showInsertCardDialog(cancelListener, "cancel");
-
- Thread.sleep(2000);
-
- gui.showCardNotSupportedDialog(cancelListener, "cancel");
-
- Thread.sleep(2000);
+// gui.showInsertCardDialog(cancelListener, "cancel");
+//
+// Thread.sleep(2000);
+//
+// gui.showCardNotSupportedDialog(cancelListener, "cancel");
+//
+// Thread.sleep(2000);
// PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN");
//
@@ -119,19 +119,23 @@ public class BKUGUIWorker implements Runnable {
// Thread.sleep(2000);
//
-// gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
-//
-// Thread.sleep(2000);
-//
-// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
-//
-// Thread.sleep(2000);
+ gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
+
+ Thread.sleep(2000);
+
+ gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
+
+ Thread.sleep(2000);
////
// gui.showErrorDialog("Testfehler occured", null, null);
//
// Thread.sleep(2000);
//
// gui.showErrorDialog("Testfehler occured");
+
+
+// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save");
+// Thread.sleep(2000);
} catch (InterruptedException ex) {
ex.printStackTrace();
diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
index 9601d39c..d206913d 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALRequestBrokerImpl.java
@@ -95,7 +95,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
currentHashDataInput = null;
for (STALRequest request : requests) {
if (request instanceof SignRequest) {
- log.trace("Received SignRequest, keep HashDataInput callback.");
+ log.trace("Received SignRequest, keep HashDataInput.");
currentHashDataInput = ((SignRequest) request).getHashDataInput();
break;
} else if (request instanceof QuitRequest) {
diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
index f0df22ea..f4cdc7d2 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
@@ -1,4 +1,4 @@
-/*
+ /*
* Copyright 2008 Federal Chancellery Austria and
* Graz University of Technology
*
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
index 2fe77c5d..1f84300a 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
@@ -146,7 +146,7 @@ public class SignRequestHandler extends AbstractRequestHandler implements
if (signedInfo != null) {
try {
gui.showWaitDialog(null);
- if (hashDataInputs == null) {
+ if (hashDataInputs == null || hashDataInputs.size() == 0) {
hashDataInputs = getHashDataInputs(signedInfo.getReference());
}
gui.showHashDataInputDialog(hashDataInputs, this, "ok");
--
cgit v1.2.3
From 84e214e4d708f13c8f09c68273541e535c560296 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Wed, 10 Sep 2008 16:54:04 +0000
Subject: gui final 0.1b
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@30 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 620 ++++++++++++++++-----
.../at/gv/egiz/bku/gui/Messages.properties | 10 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 10 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 90 ++-
.../src/test/resources/commons-logging.properties | 1 +
BKUCommonGUI/src/test/resources/log4j.properties | 19 +
6 files changed, 579 insertions(+), 171 deletions(-)
create mode 100644 BKUCommonGUI/src/test/resources/commons-logging.properties
create mode 100644 BKUCommonGUI/src/test/resources/log4j.properties
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
index 5175b45f..044e6927 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
@@ -23,43 +23,47 @@ package at.gv.egiz.bku.gui;
import at.gv.egiz.smcc.PINSpec;
import at.gv.egiz.stal.HashDataInput;
import java.awt.Color;
+import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
+import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
+import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JScrollPane;
+import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.LayoutStyle;
import javax.swing.SwingUtilities;
+import javax.swing.border.TitledBorder;
import javax.swing.filechooser.FileFilter;
+import javax.swing.table.DefaultTableModel;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableModel;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;
@@ -75,9 +79,9 @@ public class BKUGUI implements BKUGUIFacade {
private static final Log log = LogFactory.getLog(BKUGUI.class);
public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages";
public static final String LOGO_RESOURCE = "/images/logo.png";
- public static final int MAIN_PANEL_WIDTH = 100;
+// public static final int MAIN_PANEL_WIDTH = 100;
// public static final int MAIN_PANEL_HEIGHT = 20;
- public static final int PREF_SIZE_PINFIELD = 118;
+// public static final int PREF_SIZE_PINFIELD = 118;
public static final Color ERROR_COLOR = Color.RED;
public static final Color HYPERLINK_COLOR = Color.BLUE;
private static final String TITLE_WELCOME = "title.welcome";
@@ -95,18 +99,21 @@ public class BKUGUI implements BKUGUIFacade {
private static final String MESSAGE_INSERTCARD = "message.insertcard";
private static final String MESSAGE_HASHDATALINK = "message.hashdatalink";
private static final String MESSAGE_HASHDATA = "message.hashdata";
+ private static final String MESSAGE_HASHDATALIST = "message.hashdatalist";
private static final String MESSAGE_RETRIES = "message.retries";
private static final String MESSAGE_OVERWRITE = "message.overwrite";
private static final String LABEL_PIN = "label.pin";
private static final String LABEL_PINSIZE = "label.pinsize";
-// private static final String LABEL_CARDPINSIZE="label.cardpinsize";
-// private static final String LABEL_SIGNPIN="label.signpin";
-// private static final String LABEL_SIGNPINSIZE="label.signpinsize";
+ private static final String ERROR_HASHDATA = "error.hashdata";
+
private static final String BUTTON_OK = "button.ok";
private static final String BUTTON_CANCEL = "button.cancel";
+ private static final String BUTTON_BACK = "button.back";
private static final String BUTTON_SIGN = "button.sign";
private static final String BUTTON_SAVE = "button.save";
private static final String MIMETYPE_DESC_XML = "mimetype.desc.xml";
+ private static final String MIMETYPE_DESC_HTML = "mimetype.desc.html";
+ private static final String MIMETYPE_DESC_XHTML = "mimetype.desc.xhtml";
private static final String MIMETYPE_DESC_TXT = "mimetype.desc.txt";
private static final String MIMETYPE_DESC_PDF = "mimetype.desc.pdf";
private static final String MIMETYPE_DESC_BIN = "mimetype.desc.bin";
@@ -125,6 +132,15 @@ public class BKUGUI implements BKUGUIFacade {
/** remember the pinfield to return to worker */
protected JPasswordField pinField;
+ protected JButton okButton;
+ protected JButton cancelButton;
+ protected JButton signButton;
+ protected JButton saveButton;
+ protected JButton backButton;
+ protected int buttonSize;
+
+ private static final int CHECKBOX_WIDTH = new JCheckBox().getPreferredSize().width;
+
/**
* @param contentPane
* @param localeString may be null
@@ -168,9 +184,19 @@ public class BKUGUI implements BKUGUIFacade {
GroupLayout iconPanelLayout = new GroupLayout(iconPanel);
iconPanel.setLayout(iconPanelLayout);
iconPanelLayout.setHorizontalGroup(
- iconPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(iconPanelLayout.createSequentialGroup().addContainerGap().addComponent(iconLabel).addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
+ iconPanelLayout.createSequentialGroup()
+// iconPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addGroup(iconPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, iconLabel.getPreferredSize().width, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //);
iconPanelLayout.setVerticalGroup(
- iconPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(iconPanelLayout.createSequentialGroup().addContainerGap().addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE).addContainerGap(41, Short.MAX_VALUE)));
+ iconPanelLayout.createSequentialGroup()
+// iconPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addGroup(iconPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, iconLabel.getPreferredSize().height, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //);
}
protected void initContentPanel() {
@@ -190,23 +216,60 @@ public class BKUGUI implements BKUGUIFacade {
java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2));
// titleLabel.setForeground(defaultForground);
+ okButton = new JButton();
+ okButton.setText(messages.getString(BUTTON_OK));
+ cancelButton = new JButton();
+ cancelButton.setText(messages.getString(BUTTON_CANCEL));
+ signButton = new JButton();
+ signButton.setText(messages.getString(BUTTON_SIGN));
+ backButton = new JButton();
+ backButton.setText(messages.getString(BUTTON_BACK));
+ saveButton = new JButton();
+ saveButton.setText(messages.getString(BUTTON_SAVE));
+// contentPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
+
+ if (okButton.getPreferredSize().width > buttonSize)
+ buttonSize = okButton.getPreferredSize().width;
+ if (cancelButton.getPreferredSize().width > buttonSize)
+ buttonSize = cancelButton.getPreferredSize().width;
+ if (signButton.getPreferredSize().width > buttonSize)
+ buttonSize = signButton.getPreferredSize().width;
+ if (backButton.getPreferredSize().width > buttonSize)
+ buttonSize = backButton.getPreferredSize().width;
+ if (saveButton.getPreferredSize().width > buttonSize)
+ buttonSize = saveButton.getPreferredSize().width;
+
+
GroupLayout headerPanelLayout = new GroupLayout(headerPanel);
headerPanel.setLayout(headerPanelLayout);
headerPanelLayout.setHorizontalGroup(
- headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(titleLabel, GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE));
+ headerPanelLayout.createSequentialGroup()
+// headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
headerPanelLayout.setVerticalGroup(
- headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(titleLabel));
+ headerPanelLayout.createSequentialGroup()
+// headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
// mainPanel.setPreferredSize(new Dimension(MAIN_PANEL_WIDTH, MAIN_PANEL_HEIGHT));
GroupLayout contentPanelLayout = new GroupLayout(contentPanel);
contentPanel.setLayout(contentPanelLayout);
contentPanelLayout.setHorizontalGroup(
- contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(contentPanelLayout.createSequentialGroup().addContainerGap().addGroup(contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(headerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(mainPanel, GroupLayout.DEFAULT_SIZE, MAIN_PANEL_WIDTH, Short.MAX_VALUE).addComponent(buttonPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))));
+ contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //));
contentPanelLayout.setVerticalGroup(
- contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(contentPanelLayout.createSequentialGroup().addContainerGap().addComponent(headerPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(mainPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE) //79, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(buttonPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addContainerGap()));
+ contentPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) //, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap()); //);
}
@Override
@@ -229,9 +292,13 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+ mainPanelLayout.createSequentialGroup()
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(waitMsgLabel)
+ .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel));
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(waitMsgLabel));
contentPanel.validate();
}
@@ -257,9 +324,14 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+ mainPanelLayout.createSequentialGroup()
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(waitMsgLabel)
+ .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel));
+ mainPanelLayout.createSequentialGroup()
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(waitMsgLabel));
contentPanel.validate();
@@ -276,21 +348,25 @@ public class BKUGUI implements BKUGUIFacade {
buttonPanel.removeAll();
titleLabel.setText(messages.getString(TITLE_INSERTCARD));
-// titleLabel.setForeground(defaultForground);
- JButton cancelButton = new JButton();
- cancelButton.setFont(cancelButton.getFont());
- cancelButton.setText(messages.getString(BUTTON_CANCEL));
cancelButton.addActionListener(cancelListener);
cancelButton.setActionCommand(cancelCommand);
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
+// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(cancelButton).addContainerGap()));
+ buttonPanelLayout.createSequentialGroup()
+// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap()); //);
buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(cancelButton));
+ buttonPanelLayout.createSequentialGroup()
+// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(cancelButton));
contentPanel.validate();
}
@@ -308,12 +384,6 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED));
// titleLabel.setForeground(defaultForground);
- JButton cancelButton = new JButton();
- cancelButton.setFont(cancelButton.getFont());
- cancelButton.setText(messages.getString(BUTTON_CANCEL));
- cancelButton.addActionListener(cancelListener);
- cancelButton.setActionCommand(cancelCommand);
-
JLabel errorMsgLabel = new JLabel();
errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
errorMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD));
@@ -322,19 +392,33 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+ mainPanelLayout.createSequentialGroup()
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(errorMsgLabel)); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel));
+ mainPanelLayout.createSequentialGroup()
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(errorMsgLabel));
+ cancelButton.addActionListener(cancelListener);
+ cancelButton.setActionCommand(cancelCommand);
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
+// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(cancelButton).addContainerGap()));
+ buttonPanelLayout.createSequentialGroup()
+// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap()); //);
buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(cancelButton));
-
+ buttonPanelLayout.createSequentialGroup()
+// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(cancelButton));
+
contentPanel.validate();
}
});
@@ -355,16 +439,10 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_RETRY));
}
- JButton cancelButton = new JButton();
- cancelButton.setFont(cancelButton.getFont());
- cancelButton.setText(messages.getString(BUTTON_CANCEL));
cancelButton.setActionCommand(cancelCommand);
cancelButton.addActionListener(cancelListener);
- JButton okButton = new JButton();
okButton.setEnabled(false);
- okButton.setFont(okButton.getFont());
- okButton.setText(messages.getString(BUTTON_OK));
okButton.setActionCommand(okCommand);
okButton.addActionListener(okListener);
@@ -402,37 +480,77 @@ public class BKUGUI implements BKUGUIFacade {
infoLabel.setForeground(ERROR_COLOR);
}
+// GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+// mainPanel.setLayout(mainPanelLayout);
+//
+// mainPanelLayout.setHorizontalGroup(
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addGroup(mainPanelLayout.createSequentialGroup() // .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// // .addComponent(hashDataLabel)
+// // .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
+// .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) //RELATED)
+// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) //TRAILING)
+// .addComponent(infoLabel) //, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)
+// .addComponent(pinField, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)) //))
+// .addContainerGap()));
+//
+// mainPanelLayout.setVerticalGroup(
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addContainerGap() // .addComponent(hashDataLabel).addGap(14, 14, 14)
+// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) //, false)
+// .addComponent(cardPinLabel) //, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
+// .addComponent(pinField)) //, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
+// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(infoLabel).addGap(cardPinLabel.getFont().getSize()))); //10, 10, 10)));
+//
+// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+// buttonPanel.setLayout(buttonPanelLayout);
+//
+// buttonPanelLayout.setHorizontalGroup(
+// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE).addComponent(okButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton).addContainerGap()));
+// buttonPanelLayout.setVerticalGroup(
+// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(okButton).addComponent(cancelButton)));
+
+
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
-// GroupLayout.ParallelGroup mainGroup = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
-// mainGroup.addComponent(pinSizeLabel) //, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)
-// .addComponent(pinField, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE);
-
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup() // .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- // .addComponent(hashDataLabel)
- // .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
- .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) //RELATED)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) //TRAILING)
- .addComponent(infoLabel) //, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)
- .addComponent(pinField, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)) //))
- .addContainerGap()));
+ mainPanelLayout.createSequentialGroup()
+// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addComponent(hashDataLabel)
+// .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
+ .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //))
+ .addComponent(infoLabel))
+ .addContainerGap());
mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addContainerGap() // .addComponent(hashDataLabel).addGap(14, 14, 14)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) //, false)
- .addComponent(cardPinLabel) //, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
- .addComponent(pinField)) //, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(infoLabel).addGap(cardPinLabel.getFont().getSize()))); //10, 10, 10)));
+ mainPanelLayout.createSequentialGroup()
+// .addComponent(hashDataLabel)
+// .addGap(hashDataLabel.getFont().getSize())
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(cardPinLabel)
+ .addComponent(pinField))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(infoLabel));
+// .addGap(signPinLabel.getFont().getSize()));
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
+// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE).addComponent(okButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton).addContainerGap()));
+ buttonPanelLayout.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap());//);
buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(okButton).addComponent(cancelButton)));
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(okButton)
+ .addComponent(cancelButton));
pinField.requestFocusInWindow();
contentPanel.validate();
@@ -474,16 +592,10 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_RETRY));
}
- JButton cancelButton = new JButton();
- cancelButton.setFont(cancelButton.getFont());
- cancelButton.setText(messages.getString(BUTTON_CANCEL));
cancelButton.setActionCommand(cancelCommand);
cancelButton.addActionListener(cancelListener);
- JButton signButton = new JButton();
signButton.setEnabled(false);
- signButton.setFont(signButton.getFont());
- signButton.setText(messages.getString(BUTTON_SIGN));
signButton.setActionCommand(signCommand);
signButton.addActionListener(signListener);
@@ -539,22 +651,43 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(hashDataLabel).addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup().addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(infoLabel) //, GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
- .addComponent(pinField, GroupLayout.DEFAULT_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)))).addContainerGap()));
+ mainPanelLayout.createSequentialGroup()
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(hashDataLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
+ .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(infoLabel))))
+ .addContainerGap());
mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addComponent(hashDataLabel).addGap(hashDataLabel.getFont().getSize()) //14, 14, 14)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE, false).addComponent(signPinLabel) //, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
- .addComponent(pinField)) //, GroupLayout.PREFERRED_SIZE, 19, GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(infoLabel).addGap(signPinLabel.getFont().getSize()))); //10, 10, 10)));
+ mainPanelLayout.createSequentialGroup()
+ .addComponent(hashDataLabel)
+ .addGap(hashDataLabel.getFont().getSize())
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(signPinLabel)
+ .addComponent(pinField))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(infoLabel));
+// .addGap(signPinLabel.getFont().getSize()));
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
+// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE).addComponent(signButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton).addContainerGap()));
+ buttonPanelLayout.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(signButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap());//);
buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(signButton).addComponent(cancelButton)));
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(signButton)
+ .addComponent(cancelButton));
pinField.requestFocusInWindow();
contentPanel.validate();
@@ -625,23 +758,30 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(errorMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel));
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(errorMsgLabel));
- JButton okButton = new JButton();
- okButton.setFont(okButton.getFont());
- okButton.setText(messages.getString(BUTTON_OK));
okButton.setActionCommand(okCommand);
okButton.addActionListener(okListener);
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
+// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(okButton).addContainerGap()));
+ buttonPanelLayout.createSequentialGroup()
+// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap()); //);
buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(okButton));
+ buttonPanelLayout.createSequentialGroup()
+// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(okButton));
contentPanel.validate();
}
@@ -668,9 +808,13 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+ mainPanelLayout.createSequentialGroup()
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(errorMsgLabel)
+ .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel));
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(errorMsgLabel));
contentPanel.validate();
}
@@ -725,41 +869,26 @@ public class BKUGUI implements BKUGUIFacade {
showSaveHashDataInputDialog(signedRef, okListener, okCommand);
}
- } else {
- mainPanel.removeAll();
- buttonPanel.removeAll();
-
- titleLabel.setText(messages.getString(TITLE_ERROR));
- // titleLabel.setForeground(defaultForground);
+ } else if (signedReferences != null && signedReferences.size() > 1) {
+ final HashDataTableModel tableModel = new HashDataTableModel(signedReferences);
- JLabel errorMsgLabel = new JLabel();
- errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- errorMsgLabel.setText("HashDataInputDialog not supported yet.");
- errorMsgLabel.setForeground(ERROR_COLOR);
+ ActionListener al = new ActionListener() {
- GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
- mainPanel.setLayout(mainPanelLayout);
-
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(errorMsgLabel));
-
- JButton okButton = new JButton();
- okButton.setFont(okButton.getFont());
- okButton.setText(messages.getString(BUTTON_OK));
- okButton.setActionCommand(okCommand);
- okButton.addActionListener(okListener);
-
- GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
- buttonPanel.setLayout(buttonPanelLayout);
-
- buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(okButton).addContainerGap()));
- buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(okButton));
-
- contentPanel.validate();
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ List selection = tableModel.getSelectedReferenceIds();
+ StringBuilder sb = new StringBuilder("Not implemented yet. \n");
+ for (String string : selection) {
+ sb.append(string);
+ sb.append('\n');
+ }
+ showErrorDialog(sb.toString(), okListener, okCommand);
+// showSaveHashDataInputDialog(signedRef, okListener, okCommand);
+ }
+ };
+ showMultipleHashDataInputDialog(tableModel, okListener, okCommand, al, "save");
+ } else {
+ showErrorDialog(messages.getString(ERROR_HASHDATA), okListener, okCommand);
}
}
});
@@ -774,54 +903,193 @@ public class BKUGUI implements BKUGUIFacade {
JLabel refIdLabel = new JLabel();
refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
String refIdLabelPattern = messages.getString(MESSAGE_HASHDATA);
- refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[] {refId} ));
+ refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{refId}));
JScrollPane hashDataScrollPane = new JScrollPane();
JTextArea hashDataTextArea = new JTextArea(text);
hashDataTextArea.setEditable(false);
- hashDataTextArea.setColumns(20);
- hashDataTextArea.setRows(3);
+ hashDataTextArea.setColumns(1);
+ hashDataTextArea.setRows(1);
hashDataScrollPane.setViewportView(hashDataTextArea);
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
+
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createSequentialGroup()
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(refIdLabel)
+ .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap());
+
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createSequentialGroup()
+ .addComponent(refIdLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(hashDataScrollPane, 0, GroupLayout.PREFERRED_SIZE, hashDataTextArea.getPreferredSize().height+3));
+
- JButton cancelButton = new JButton();
- cancelButton.setFont(cancelButton.getFont());
- cancelButton.setText(messages.getString(BUTTON_CANCEL));
- cancelButton.setActionCommand(cancelCommand);
- cancelButton.addActionListener(cancelListener);
+
+// GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+// mainPanel.setLayout(mainPanelLayout);
+//
+// mainPanelLayout.setHorizontalGroup(
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(refIdLabel).addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)).addContainerGap()));
+//
+// mainPanelLayout.setVerticalGroup(
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addComponent(refIdLabel).addGap(refIdLabel.getFont().getSize()).addComponent(hashDataScrollPane).addGap(refIdLabel.getFont().getSize())));
+
+ backButton.setActionCommand(cancelCommand);
+ backButton.addActionListener(cancelListener);
- JButton saveButton = new JButton();
- saveButton.setFont(saveButton.getFont());
- saveButton.setText(messages.getString(BUTTON_SAVE));
saveButton.setActionCommand(saveCommand);
saveButton.addActionListener(saveListener);
+
+ GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+ buttonPanel.setLayout(buttonPanelLayout);
+
+// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
+ buttonPanelLayout.setHorizontalGroup(
+ buttonPanelLayout.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap());
+ buttonPanelLayout.setVerticalGroup(
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(saveButton)
+ .addComponent(backButton));
+
+
+// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+// buttonPanel.setLayout(buttonPanelLayout);
+//
+// buttonPanelLayout.setHorizontalGroup(
+// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE).addComponent(saveButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton).addContainerGap()));
+// buttonPanelLayout.setVerticalGroup(
+// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(saveButton).addComponent(cancelButton)));
+
+ contentPanel.validate();
+ }
+
+ private void showMultipleHashDataInputDialog(final TableModel signedReferences, final ActionListener cancelListener, final String cancelCommand, ActionListener saveListener, String saveCommand) {
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
+
+ titleLabel.setText(messages.getString(TITLE_HASHDATA));
+ JLabel refIdLabel = new JLabel();
+ refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ String refIdLabelPattern = messages.getString(MESSAGE_HASHDATALIST);
+ refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.getRowCount()}));
+
+ JTable hashDataTable = new JTable();
+ hashDataTable.setModel(signedReferences);
+ hashDataTable.setTableHeader(null);
+// hashDataTable.setShowVerticalLines(false);
+// hashDataTable.setRowSelectionAllowed(false);
+ TableColumn selectCol = hashDataTable.getColumnModel().getColumn(1);
+ selectCol.setMinWidth(CHECKBOX_WIDTH);
+ selectCol.setMaxWidth(CHECKBOX_WIDTH);
+
+
+ hashDataTable.setPreferredScrollableViewportSize(mainPanel.getPreferredSize());
+
+ JScrollPane hashDataScrollPane = new JScrollPane(hashDataTable);
+
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(refIdLabel)
- .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE))
- .addContainerGap()));
-
+ mainPanelLayout.createSequentialGroup()
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(refIdLabel)
+ .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap());
+
mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addComponent(refIdLabel)
- .addGap(refIdLabel.getFont().getSize())
- .addComponent(hashDataScrollPane)
- .addGap(refIdLabel.getFont().getSize())));
-
+ mainPanelLayout.createSequentialGroup()
+ .addComponent(refIdLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(hashDataScrollPane, 0, GroupLayout.PREFERRED_SIZE, hashDataTable.getPreferredSize().height+3));
+// .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED));
+
+
+
+//
+// GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+// mainPanel.setLayout(mainPanelLayout);
+//
+// mainPanelLayout.setHorizontalGroup(
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addGroup(mainPanelLayout.createSequentialGroup()
+// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addComponent(refIdLabel)
+// .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE))
+// .addContainerGap()));
+//
+// mainPanelLayout.setVerticalGroup(
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addGroup(mainPanelLayout.createSequentialGroup()
+// .addComponent(refIdLabel)
+// .addGap(refIdLabel.getFont().getSize())
+// .addComponent(hashDataScrollPane)
+// .addGap(refIdLabel.getFont().getSize())));
+
+
+
+
+
+
+
+
+
+
+
+
+// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+// buttonPanel.setLayout(buttonPanelLayout);
+//
+// buttonPanelLayout.setHorizontalGroup(
+// buttonPanelLayout.createSequentialGroup()
+//// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+//// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
+// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+// .addComponent(saveButton)
+// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+// .addComponent(cancelButton)
+// .addContainerGap()); //);
+// buttonPanelLayout.setVerticalGroup(
+// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
+// .addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+// .addComponent(saveButton)
+// .addComponent(cancelButton))
+// .addContainerGap()));
+
+
+ backButton.setActionCommand(cancelCommand);
+ backButton.addActionListener(cancelListener);
+
+ saveButton.setActionCommand(saveCommand);
+ saveButton.addActionListener(saveListener);
+
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
+// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE).addComponent(saveButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton).addContainerGap()));
+ buttonPanelLayout.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap());//);
buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(saveButton).addComponent(cancelButton)));
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(saveButton)
+ .addComponent(backButton));
contentPanel.validate();
}
@@ -901,9 +1169,13 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+ mainPanelLayout.createSequentialGroup()
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(waitMsgLabel)
+ .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(waitMsgLabel));
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(waitMsgLabel));
contentPanel.validate();
}
@@ -975,13 +1247,17 @@ public class BKUGUI implements BKUGUIFacade {
String ext = getExtension(f);
if ("text/xml".equals(mimeType)) {
- return "xml".equals(ext);
+ return "xml".equalsIgnoreCase(ext);
+ } else if ("text/html".equals(mimeType)) {
+ return "html".equalsIgnoreCase(ext) || "htm".equalsIgnoreCase(ext);
+ } else if ("application/xhtml+xml".equals(mimeType)) {
+ return "xhtml".equalsIgnoreCase(ext);
} else if ("text/plain".equals(mimeType)) {
- return "txt".equals(ext);
+ return "txt".equalsIgnoreCase(ext);
} else if ("application/pdf".equals(mimeType)) {
- return "pdf".equals(ext);
+ return "pdf".equalsIgnoreCase(ext);
} else {
- return "bin".equals(ext);
+ return true;
}
}
@@ -1000,6 +1276,10 @@ public class BKUGUI implements BKUGUIFacade {
public String getDescription() {
if ("text/xml".equals(mimeType)) {
return messages.getString(MIMETYPE_DESC_XML);
+ } else if ("text/html".equals(mimeType)) {
+ return messages.getString(MIMETYPE_DESC_HTML);
+ } else if ("application/xhtml+xml".equals(mimeType)) {
+ return messages.getString(MIMETYPE_DESC_XHTML);
} else if ("text/plain".equals(mimeType)) {
return messages.getString(MIMETYPE_DESC_TXT);
} else if ("application/pdf".equals(mimeType)) {
@@ -1012,6 +1292,10 @@ public class BKUGUI implements BKUGUIFacade {
public String getExtension() {
if ("text/xml".equals(mimeType)) {
return ".xml";
+ } else if ("text/html".equals(mimeType)) {
+ return ".html";
+ } else if ("application/xhtml+xml".equals(mimeType)) {
+ return ".xhtml";
} else if ("text/plain".equals(mimeType)) {
return ".txt";
} else if ("application/pdf".equals(mimeType)) {
@@ -1021,4 +1305,34 @@ public class BKUGUI implements BKUGUIFacade {
}
}
}
+
+ class HashDataTableModel extends DefaultTableModel {
+
+ Class[] types = new Class[]{
+ java.lang.String.class, java.lang.Boolean.class
+ };
+
+ public HashDataTableModel(List signedReferences) {
+ super(0, 2);
+ for (HashDataInput hashDataInput : signedReferences) {
+ addRow(new Object[]{hashDataInput.getReferenceId(), new Boolean(true)});
+ }
+ }
+
+ @Override
+ public Class getColumnClass(int columnIndex) {
+ return types [columnIndex];
+ }
+
+ public List getSelectedReferenceIds() {
+ ArrayList selection = new ArrayList();
+ for (Object row : dataVector) {
+ if ((Boolean) ((Vector) row).elementAt(1)) {
+ selection.add((String) ((Vector) row).elementAt(0));
+ }
+ }
+ return selection;
+ }
+
+ }
}
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index 21a6bd1b..b651fa8d 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -25,18 +25,24 @@ title.hashdata=Signaturdaten
windowtitle.save=Signaturdaten speichern
windowtitle.overwrite=Datei \u00FCberschreiben?
message.wait=Bitte warten...
-message.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken.
+message.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken
message.hashdatalink=Signaturdaten anzeigen...
-message.hashdata=Referenz Id: {0}
+message.hashdata=Ein textuelles Signaturdatenobjekt:
+#message.hashdata=Referenz Id: {0}
+message.hashdatalist={0} Signaturdatenobjekte:
message.retries=Noch {0} Versuche
message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?
label.pin={0}:
label.pinsize=({0} stellig)
+error.hashdata=Keine Signaturdaten verf\u00FCgbar
button.ok=OK
button.cancel=Abbrechen
+button.back=Zur\u00FCck
button.sign=Signieren
button.save=Speichern...
mimetype.desc.xml=XML-Dateien (*.xml)
+mimetype.desc.html=HTML-Dateien (*.html, *.htm)
+mimetype.desc.xhtml=XHTML-Dateien (*.xhtml)
mimetype.desc.txt=Textdateien (*.txt)
mimetype.desc.pdf=Adobe PDF-Dateien (*.pdf)
mimetype.desc.bin=Bin\u00E4rdateien (*.bin)
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
index 4dc1f8b3..a9c21a00 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
@@ -21,6 +21,8 @@
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;
@@ -36,7 +38,9 @@ public class BKUGUITest {
public void testBKUGUI() {
JFrame testFrame = new JFrame("BKUGUITest");
BKUGUI gui = new BKUGUI();
- gui.init(testFrame.getContentPane(), null);
+ Container contentPane = testFrame.getContentPane();
+ contentPane.setPreferredSize(new Dimension(500, 200));
+ gui.init(contentPane, null);
BKUGUIWorker worker = new BKUGUIWorker();
worker.init(gui);
testFrame.pack();
@@ -50,4 +54,8 @@ public class BKUGUITest {
@Test
public void dummyTest() {
}
+
+// public static void main(String[] args) {
+// new BKUGUITest().testBKUGUI();
+// }
}
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index e2f478c9..4367f642 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -26,7 +26,8 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
-import java.util.Collections;
+import java.util.ArrayList;
+import java.util.List;
/**
*
@@ -42,7 +43,7 @@ public class BKUGUIWorker implements Runnable {
@Override
public void run() {
- try {
+// try {
final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN");
@@ -77,11 +78,11 @@ public class BKUGUIWorker implements Runnable {
gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", null, "hashdata");
}
};
- HashDataInput signedRef = new HashDataInput() {
+ HashDataInput signedRef1 = new HashDataInput() {
@Override
public InputStream getHashDataInput() {
- return new ByteArrayInputStream("HashDataInput_002 ".getBytes());
+ return new ByteArrayInputStream("HashDataInput_001\n12345\n\tHello, world!\n12345\n\n12345\n6789\nblabla".getBytes());
}
@Override
@@ -91,10 +92,69 @@ public class BKUGUIWorker implements Runnable {
@Override
public String getReferenceId() {
- return "ref123";
+ return "Reference-ref1-00000000000000000000001";
}
};
- gui.showHashDataInputDialog(Collections.singletonList(signedRef), returnListener, "return");
+ HashDataInput signedRef2 = new HashDataInput() {
+
+ @Override
+ public InputStream getHashDataInput() {
+ return new ByteArrayInputStream("HashDataInput_002 ".getBytes());
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/xml";
+ }
+
+ @Override
+ public String getReferenceId() {
+ return "Reference-ref2-00000000000000000000002";
+ }
+ };
+ HashDataInput signedRef3 = new HashDataInput() {
+
+ @Override
+ public InputStream getHashDataInput() {
+ return new ByteArrayInputStream("HashDataInput_003 ".getBytes());
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/xml";
+ }
+
+ @Override
+ public String getReferenceId() {
+ return "Reference-ref3-00000000000000000000003";
+ }
+ };
+ HashDataInput signedRef4 = new HashDataInput() {
+
+ @Override
+ public InputStream getHashDataInput() {
+ return new ByteArrayInputStream("HashDataInput_004 ".getBytes());
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/xml";
+ }
+
+ @Override
+ public String getReferenceId() {
+ return "ref4";
+ }
+ };
+
+ //
+ List signedRefs = new ArrayList();
+ signedRefs.add(signedRef1);
+ signedRefs.add(signedRef2);
+ signedRefs.add(signedRef3);
+ signedRefs.add(signedRef4);
+// signedRefs = Collections.singletonList(signedRef1);
+ gui.showHashDataInputDialog(signedRefs, returnListener, "return");
}
};
@@ -105,7 +165,7 @@ public class BKUGUIWorker implements Runnable {
// Thread.sleep(2000);
// gui.showInsertCardDialog(cancelListener, "cancel");
-//
+
// Thread.sleep(2000);
//
// gui.showCardNotSupportedDialog(cancelListener, "cancel");
@@ -113,7 +173,7 @@ public class BKUGUIWorker implements Runnable {
// Thread.sleep(2000);
// PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN");
-//
+////
// gui.showCardPINDialog(cardPinSpec, okListener, "ok", cancelListener, "cancel");
//
// Thread.sleep(2000);
@@ -121,11 +181,11 @@ public class BKUGUIWorker implements Runnable {
gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
- Thread.sleep(2000);
+// Thread.sleep(2000);
- gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
-
- Thread.sleep(2000);
+// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
+//
+// Thread.sleep(2000);
////
// gui.showErrorDialog("Testfehler occured", null, null);
//
@@ -137,8 +197,8 @@ public class BKUGUIWorker implements Runnable {
// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save");
// Thread.sleep(2000);
- } catch (InterruptedException ex) {
- ex.printStackTrace();
- }
+// } catch (InterruptedException ex) {
+// ex.printStackTrace();
+// }
}
}
diff --git a/BKUCommonGUI/src/test/resources/commons-logging.properties b/BKUCommonGUI/src/test/resources/commons-logging.properties
new file mode 100644
index 00000000..29292562
--- /dev/null
+++ b/BKUCommonGUI/src/test/resources/commons-logging.properties
@@ -0,0 +1 @@
+org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
diff --git a/BKUCommonGUI/src/test/resources/log4j.properties b/BKUCommonGUI/src/test/resources/log4j.properties
new file mode 100644
index 00000000..053eac17
--- /dev/null
+++ b/BKUCommonGUI/src/test/resources/log4j.properties
@@ -0,0 +1,19 @@
+# loglever DEBUG, appender STDOUT
+log4j.rootLogger=TRACE, STDOUT
+#log4j.logger.at.gv.egiz.slbinding.RedirectEventFilter=DEBUG, STDOUT
+
+# STDOUT appender
+log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
+log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
+#log4j.appender.STDOUT.layout.ConversionPattern=%5p | %d{dd HH:mm:ss,SSS} | %20c | %10t | %m%n
+#log4j.appender.STDOUT.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
+log4j.appender.STDOUT.layout.ConversionPattern=%-5p |%d | %t | %c %x- %m%n
+
+### FILE appender
+#log4j.appender.file=org.apache.log4j.RollingFileAppender
+#log4j.appender.file.maxFileSize=100KB
+#log4j.appender.file.maxBackupIndex=9
+#log4j.appender.file.File=egovbus_ca.log
+#log4j.appender.file.threshold=info
+#log4j.appender.file.layout=org.apache.log4j.PatternLayout
+#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
\ No newline at end of file
--
cgit v1.2.3
From 3794536434fdbb06067eddcfd248898ce85f85a1 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Fri, 12 Sep 2008 13:06:34 +0000
Subject: gui 0.2
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@34 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../at/gv/egiz/bku/online/applet/BKUApplet.java | 102 ++-
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 885 ++++++++++-----------
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 2 +
.../at/gv/egiz/bku/gui/HashDataTableModel.java | 71 ++
.../main/java/at/gv/egiz/bku/gui/MimeFilter.java | 98 +++
.../main/java/at/gv/egiz/bku/gui/PinDocument.java | 58 ++
.../at/gv/egiz/bku/gui/Messages.properties | 15 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 276 +++----
BKUOnline/pom.xml | 13 +-
.../gv/egiz/bku/smccstal/SignRequestHandler.java | 6 +-
10 files changed, 840 insertions(+), 686 deletions(-)
create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/MimeFilter.java
create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
index 8289f30b..c7df0871 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
@@ -34,63 +34,59 @@ import at.gv.egiz.bku.gui.BKUGUIFactory;
*/
public class BKUApplet extends JApplet {
- private static Log log = LogFactory.getLog(BKUApplet.class);
+ private static Log log = LogFactory.getLog(BKUApplet.class);
+ public final static String RESOURCE_BUNDLE_BASE = "at/gv/egiz/bku/online/applet/Messages";
+ public final static String LOCALE_PARAM_KEY = "Locale";
+ public final static String LOGO_URL_KEY = "LogoURL";
+ public final static String WSDL_URL = "WSDL_URL";
+ public final static String SESSION_ID = "SessionID";
+ protected ResourceBundle resourceBundle;
+ protected BKUWorker worker;
+ protected Thread workerThread;
- public final static String RESOURCE_BUNDLE_BASE = "at/gv/egiz/bku/online/applet/Messages";
+ public BKUApplet() {
+ }
- public final static String LOCALE_PARAM_KEY = "Locale";
- public final static String LOGO_URL_KEY = "LogoURL";
- public final static String WSDL_URL = "WSDL_URL";
- public final static String SESSION_ID = "SessionID";
+ public void init() {
+ log.debug("Called init()");
+ HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance());
+ String localeString = getMyAppletParameter(LOCALE_PARAM_KEY);
+ if (localeString != null) {
+ resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE,
+ new Locale(localeString));
+ } else {
+ resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE);
+ }
+ BKUGUIFacade gui = BKUGUIFactory.createGUI();
+ gui.init(getContentPane(), localeString);
+ worker = new BKUWorker(gui, this, resourceBundle);
+ }
- protected ResourceBundle resourceBundle;
- protected BKUWorker worker;
- protected Thread workerThread;
+ public void start() {
+ log.debug("Called start()");
+ workerThread = new Thread(worker);
+ workerThread.start();
+ }
- public BKUApplet() {
- }
+ public void stop() {
+ log.debug("Called stop()");
+ if ((workerThread != null) && (workerThread.isAlive())) {
+ workerThread.interrupt();
+ }
+ }
- public void init() {
- log.debug("Called init()");
- HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory
- .getInstance());
- String localeString = getMyAppletParameter(LOCALE_PARAM_KEY);
- if (localeString != null) {
- resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE,
- new Locale(localeString));
- } else {
- resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE);
- }
- BKUGUIFacade gui = BKUGUIFactory.createGUI();
- gui.init(getContentPane(), localeString);
- worker = new BKUWorker(gui, this, resourceBundle);
- }
+ public void destroy() {
+ log.debug("Called destroy()");
+ }
- public void start() {
- log.debug("Called start()");
- workerThread = new Thread(worker);
- workerThread.start();
- }
-
- public void stop() {
- log.debug("Called stop()");
- if ((workerThread != null) && (workerThread.isAlive())) {
- workerThread.interrupt();
- }
- }
-
- public void destroy() {
- log.debug("Called destroy()");
- }
-
- /**
- * Applet configuration parameters
- *
- * @param paramKey
- * @return
- */
- public String getMyAppletParameter(String paramKey) {
- log.info("Getting parameter: " + paramKey + ": " + getParameter(paramKey));
- return getParameter(paramKey);
- }
+ /**
+ * Applet configuration parameters
+ *
+ * @param paramKey
+ * @return
+ */
+ public String getMyAppletParameter(String paramKey) {
+ log.info("Getting parameter: " + paramKey + ": " + getParameter(paramKey));
+ return getParameter(paramKey);
+ }
}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
index 044e6927..584dba1a 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
@@ -27,6 +27,7 @@ import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Dimension;
+import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@@ -75,13 +76,11 @@ import org.apache.commons.logging.LogFactory;
* @author clemens
*/
public class BKUGUI implements BKUGUIFacade {
-
+
private static final Log log = LogFactory.getLog(BKUGUI.class);
public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages";
public static final String LOGO_RESOURCE = "/images/logo.png";
-// public static final int MAIN_PANEL_WIDTH = 100;
-// public static final int MAIN_PANEL_HEIGHT = 20;
-// public static final int PREF_SIZE_PINFIELD = 118;
+ public static final String HASHDATA_FONT = "Monospaced";
public static final Color ERROR_COLOR = Color.RED;
public static final Color HYPERLINK_COLOR = Color.BLUE;
private static final String TITLE_WELCOME = "title.welcome";
@@ -94,6 +93,7 @@ public class BKUGUI implements BKUGUIFacade {
private static final String TITLE_WAIT = "title.wait";
private static final String TITLE_HASHDATA = "title.hashdata";
private static final String WINDOWTITLE_SAVE = "windowtitle.save";
+ private static final String WINDOWTITLE_SAVEDIR = "windowtitle.savedir";
private static final String WINDOWTITLE_OVERWRITE = "windowtitle.overwrite";
private static final String MESSAGE_WAIT = "message.wait";
private static final String MESSAGE_INSERTCARD = "message.insertcard";
@@ -104,19 +104,13 @@ public class BKUGUI implements BKUGUIFacade {
private static final String MESSAGE_OVERWRITE = "message.overwrite";
private static final String LABEL_PIN = "label.pin";
private static final String LABEL_PINSIZE = "label.pinsize";
- private static final String ERROR_HASHDATA = "error.hashdata";
+ private static final String ERROR_NO_HASHDATA = "error.no.hashdata";
private static final String BUTTON_OK = "button.ok";
private static final String BUTTON_CANCEL = "button.cancel";
private static final String BUTTON_BACK = "button.back";
private static final String BUTTON_SIGN = "button.sign";
private static final String BUTTON_SAVE = "button.save";
- private static final String MIMETYPE_DESC_XML = "mimetype.desc.xml";
- private static final String MIMETYPE_DESC_HTML = "mimetype.desc.html";
- private static final String MIMETYPE_DESC_XHTML = "mimetype.desc.xhtml";
- private static final String MIMETYPE_DESC_TXT = "mimetype.desc.txt";
- private static final String MIMETYPE_DESC_PDF = "mimetype.desc.pdf";
- private static final String MIMETYPE_DESC_BIN = "mimetype.desc.bin";
private static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix";
protected Container contentPane;
protected ResourceBundle messages;
@@ -132,11 +126,11 @@ public class BKUGUI implements BKUGUIFacade {
/** remember the pinfield to return to worker */
protected JPasswordField pinField;
- protected JButton okButton;
- protected JButton cancelButton;
- protected JButton signButton;
- protected JButton saveButton;
- protected JButton backButton;
+// protected JButton okButton;
+// protected JButton cancelButton;
+// protected JButton signButton;
+// protected JButton saveButton;
+// protected JButton backButton;
protected int buttonSize;
private static final int CHECKBOX_WIDTH = new JCheckBox().getPreferredSize().width;
@@ -216,28 +210,43 @@ public class BKUGUI implements BKUGUIFacade {
java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2));
// titleLabel.setForeground(defaultForground);
- okButton = new JButton();
- okButton.setText(messages.getString(BUTTON_OK));
- cancelButton = new JButton();
- cancelButton.setText(messages.getString(BUTTON_CANCEL));
- signButton = new JButton();
- signButton.setText(messages.getString(BUTTON_SIGN));
- backButton = new JButton();
- backButton.setText(messages.getString(BUTTON_BACK));
- saveButton = new JButton();
- saveButton.setText(messages.getString(BUTTON_SAVE));
+// okButton = new JButton();
+// okButton.setText(messages.getString(BUTTON_OK));
+// cancelButton = new JButton();
+// cancelButton.setText(messages.getString(BUTTON_CANCEL));
+// signButton = new JButton();
+// signButton.setText(messages.getString(BUTTON_SIGN));
+// backButton = new JButton();
+// backButton.setText(messages.getString(BUTTON_BACK));
+// saveButton = new JButton();
+// saveButton.setText(messages.getString(BUTTON_SAVE));
// contentPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
- if (okButton.getPreferredSize().width > buttonSize)
- buttonSize = okButton.getPreferredSize().width;
- if (cancelButton.getPreferredSize().width > buttonSize)
- buttonSize = cancelButton.getPreferredSize().width;
- if (signButton.getPreferredSize().width > buttonSize)
- buttonSize = signButton.getPreferredSize().width;
- if (backButton.getPreferredSize().width > buttonSize)
- buttonSize = backButton.getPreferredSize().width;
- if (saveButton.getPreferredSize().width > buttonSize)
- buttonSize = saveButton.getPreferredSize().width;
+ JButton b = new JButton();
+ b.setText(messages.getString(BUTTON_CANCEL));
+ if (b.getPreferredSize().width > buttonSize)
+ buttonSize = b.getPreferredSize().width;
+ b.setText(messages.getString(BUTTON_OK));
+ if (b.getPreferredSize().width > buttonSize)
+ buttonSize = b.getPreferredSize().width;
+ b.setText(messages.getString(BUTTON_SIGN));
+ if (b.getPreferredSize().width > buttonSize)
+ buttonSize = b.getPreferredSize().width;
+ b.setText(messages.getString(BUTTON_BACK));
+ if (b.getPreferredSize().width > buttonSize)
+ buttonSize = b.getPreferredSize().width;
+ b.setText(messages.getString(BUTTON_SAVE));
+ if (b.getPreferredSize().width > buttonSize)
+ buttonSize = b.getPreferredSize().width;
+
+// if (cancelButton.getPreferredSize().width > buttonSize)
+// buttonSize = cancelButton.getPreferredSize().width;
+// if (signButton.getPreferredSize().width > buttonSize)
+// buttonSize = signButton.getPreferredSize().width;
+// if (backButton.getPreferredSize().width > buttonSize)
+// buttonSize = backButton.getPreferredSize().width;
+// if (saveButton.getPreferredSize().width > buttonSize)
+// buttonSize = saveButton.getPreferredSize().width;
GroupLayout headerPanelLayout = new GroupLayout(headerPanel);
@@ -349,6 +358,8 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_INSERTCARD));
+ JButton cancelButton = new JButton();
+ cancelButton.setText(messages.getString(BUTTON_CANCEL));
cancelButton.addActionListener(cancelListener);
cancelButton.setActionCommand(cancelCommand);
@@ -400,6 +411,8 @@ public class BKUGUI implements BKUGUIFacade {
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(errorMsgLabel));
+ JButton cancelButton = new JButton();
+ cancelButton.setText(messages.getString(BUTTON_CANCEL));
cancelButton.addActionListener(cancelListener);
cancelButton.setActionCommand(cancelCommand);
@@ -439,9 +452,13 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_RETRY));
}
+ JButton cancelButton = new JButton();
+ cancelButton.setText(messages.getString(BUTTON_CANCEL));
cancelButton.setActionCommand(cancelCommand);
cancelButton.addActionListener(cancelListener);
+ JButton okButton = new JButton();
+ okButton.setText(messages.getString(BUTTON_OK));
okButton.setEnabled(false);
okButton.setActionCommand(okCommand);
okButton.addActionListener(okListener);
@@ -592,9 +609,13 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_RETRY));
}
+ JButton cancelButton = new JButton();
+ cancelButton.setText(messages.getString(BUTTON_CANCEL));
cancelButton.setActionCommand(cancelCommand);
cancelButton.addActionListener(cancelListener);
+ JButton signButton = new JButton();
+ signButton.setText(messages.getString(BUTTON_SIGN));
signButton.setEnabled(false);
signButton.setActionCommand(signCommand);
signButton.addActionListener(signListener);
@@ -764,6 +785,8 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(errorMsgLabel));
+ JButton okButton = new JButton();
+ okButton.setText(messages.getString(BUTTON_OK));
okButton.setActionCommand(okCommand);
okButton.addActionListener(okListener);
@@ -790,343 +813,386 @@ public class BKUGUI implements BKUGUIFacade {
@Override
public void showErrorDialog(final String errorMsg) {
- SwingUtilities.invokeLater(new Runnable() {
+ SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- mainPanel.removeAll();
- buttonPanel.removeAll();
+ @Override
+ public void run() {
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
- titleLabel.setText(messages.getString(TITLE_ERROR));
+ titleLabel.setText(messages.getString(TITLE_ERROR));
// titleLabel.setForeground(defaultForground);
- JLabel errorMsgLabel = new JLabel();
- errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- errorMsgLabel.setText("" + errorMsg + "");
- errorMsgLabel.setForeground(ERROR_COLOR);
+ JLabel errorMsgLabel = new JLabel();
+ errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ errorMsgLabel.setText("" + errorMsg + "");
+ errorMsgLabel.setForeground(ERROR_COLOR);
- GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
- mainPanel.setLayout(mainPanelLayout);
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createSequentialGroup()
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(errorMsgLabel)
- .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(errorMsgLabel));
+ .addComponent(errorMsgLabel)
+ .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(errorMsgLabel));
- contentPanel.validate();
- }
- });
+ contentPanel.validate();
+ }
+ });
}
@Override
public void showHashDataInputDialog(final List signedReferences, final ActionListener okListener, final String okCommand) {
- SwingUtilities.invokeLater(new Runnable() {
+
+ if (signedReferences == null) {
+ showErrorDialog(messages.getString(ERROR_NO_HASHDATA), okListener, okCommand);
+ }
+
+ if (signedReferences.size() == 1) {
+
+// final HashDataInput signedRef = signedReferences.get(0);
+
+ if ("text/plain".equals(signedReferences.get(0).getMimeType())) {
+
+ ActionListener saveHashDataListener = new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ showSaveHashDataInputDialog(signedReferences, okListener, okCommand);
+ }
+ };
+ String hashDataText = getText(signedReferences.get(0));
+ if (hashDataText != null) {
+ showPlainTextHashDataInputDialog(hashDataText, saveHashDataListener, "save", okListener, okCommand);
+ } else {
+ showErrorDialog(messages.getString(ERROR_NO_HASHDATA), okListener, okCommand);
+ }
+
+ } else {
+ showSaveHashDataInputDialog(signedReferences, okListener, okCommand);
+ }
+
+ } else {
- @Override
- public void run() {
+ final HashDataTableModel tableModel = new HashDataTableModel(signedReferences);
- if (signedReferences != null && signedReferences.size() == 1) {
-
- final HashDataInput signedRef = signedReferences.get(0);
- if ("text/plain".equals(signedRef.getMimeType())) {
- //TODO get encoding from mimetype
- //read directly to byte[] since hashDataIS is backed by byte[] ?
- ByteArrayOutputStream baos = null;
- try {
- String refId = signedRef.getReferenceId();
- InputStream hashDataIS = signedRef.getHashDataInput();
- if (hashDataIS == null) {
- showErrorDialog("Failed to obtain HashDataInput for reference " + refId, okListener, okCommand);
- } else {
- baos = new ByteArrayOutputStream(hashDataIS.available());
- int c;
- while ((c = hashDataIS.read()) != -1) {
- baos.write(c);
- }
- String text = baos.toString("UTF-8");
-
- ActionListener al = new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- showSaveHashDataInputDialog(signedRef, okListener, okCommand);
- }
- };
- showPlainTextHashDataInputDialog(text, refId, okListener, okCommand, al, "save");
- }
- } catch (IOException ex) {
- showErrorDialog("Failed to read HashDataInput for reference " + signedRef.getReferenceId() + ": " + ex.getMessage(), okListener, okCommand);
- } finally {
- try {
- baos.close();
- } catch (IOException ex) {
- }
- }
- } else {
- showSaveHashDataInputDialog(signedRef, okListener, okCommand);
- }
+ ActionListener saveHashDataListener = new ActionListener() {
- } else if (signedReferences != null && signedReferences.size() > 1) {
- final HashDataTableModel tableModel = new HashDataTableModel(signedReferences);
-
- ActionListener al = new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- List selection = tableModel.getSelectedReferenceIds();
- StringBuilder sb = new StringBuilder("Not implemented yet. \n");
- for (String string : selection) {
- sb.append(string);
- sb.append('\n');
- }
- showErrorDialog(sb.toString(), okListener, okCommand);
-// showSaveHashDataInputDialog(signedRef, okListener, okCommand);
- }
- };
- showMultipleHashDataInputDialog(tableModel, okListener, okCommand, al, "save");
- } else {
- showErrorDialog(messages.getString(ERROR_HASHDATA), okListener, okCommand);
- }
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ showSaveHashDataInputDialog(tableModel.getSelectedHashData(), okListener, okCommand);
}
- });
+ };
+ showMultipleHashDataInputDialog(tableModel, okListener, okCommand, saveHashDataListener, "save");
+ }
+ }
+
+ private static String getText(HashDataInput hdi) {
+ ByteArrayOutputStream baos = null;
+ try {
+ InputStream hashDataIS = hdi.getHashDataInput();
+ if (hashDataIS == null) {
+ log.error("No HashDataInput stream for reference " + hdi.getReferenceId());
+ return null;
+ } else {
+ baos = new ByteArrayOutputStream(hashDataIS.available());
+ int c;
+ while ((c = hashDataIS.read()) != -1) {
+ baos.write(c);
+ }
+ return baos.toString("UTF-8");
+ }
+ } catch (IOException ex) {
+ log.error("Failed to read HashDataInput for reference " + hdi.getReferenceId() + ": " + ex.getMessage());
+ return null;
+ } finally {
+ try {
+ baos.close();
+ } catch (IOException ex) {
+ }
+ }
}
- private void showPlainTextHashDataInputDialog(String text, String refId, ActionListener cancelListener, String cancelCommand, ActionListener saveListener, String saveCommand) {
- mainPanel.removeAll();
- buttonPanel.removeAll();
+ private void showPlainTextHashDataInputDialog(final String hashDataText, final ActionListener saveListener, final String saveCommand, final ActionListener cancelListener, final String cancelCommand) {
+ SwingUtilities.invokeLater(new Runnable() {
- titleLabel.setText(messages.getString(TITLE_HASHDATA));
+ @Override
+ public void run() {
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
+
+ titleLabel.setText(messages.getString(TITLE_HASHDATA));
+
+ JLabel refIdLabel = new JLabel();
+ refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ refIdLabel.setText(messages.getString(MESSAGE_HASHDATA)); //MessageFormat.format(refIdLabelPattern, new Object[]{refId}));
+
+ JScrollPane hashDataScrollPane = new JScrollPane();
+ JTextArea hashDataTextArea = new JTextArea(hashDataText);
+ hashDataTextArea.setEditable(false);
+ hashDataTextArea.setColumns(1);
+ hashDataTextArea.setRows(1);
+ hashDataTextArea.setFont(new Font(HASHDATA_FONT, hashDataTextArea.getFont().getStyle(), hashDataTextArea.getFont().getSize()));
+ hashDataScrollPane.setViewportView(hashDataTextArea);
+
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
+
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createSequentialGroup()
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(refIdLabel)
+ .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap());
+
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createSequentialGroup()
+ .addComponent(refIdLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(hashDataScrollPane, 0, GroupLayout.PREFERRED_SIZE, hashDataTextArea.getPreferredSize().height+3));
+
+
+
+ // GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ // mainPanel.setLayout(mainPanelLayout);
+ //
+ // mainPanelLayout.setHorizontalGroup(
+ // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(refIdLabel).addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)).addContainerGap()));
+ //
+ // mainPanelLayout.setVerticalGroup(
+ // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addComponent(refIdLabel).addGap(refIdLabel.getFont().getSize()).addComponent(hashDataScrollPane).addGap(refIdLabel.getFont().getSize())));
+
+ JButton backButton = new JButton();
+ backButton.setText(messages.getString(BUTTON_BACK));
+ backButton.setActionCommand(cancelCommand);
+ backButton.addActionListener(cancelListener);
+
+ JButton saveButton = new JButton();
+ saveButton.setText(messages.getString(BUTTON_SAVE));
+ saveButton.setActionCommand(saveCommand);
+ saveButton.addActionListener(saveListener);
+
+ GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+ buttonPanel.setLayout(buttonPanelLayout);
+
+ // buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
+ buttonPanelLayout.setHorizontalGroup(
+ buttonPanelLayout.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap());
+ buttonPanelLayout.setVerticalGroup(
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(saveButton)
+ .addComponent(backButton));
+
+
+ // GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+ // buttonPanel.setLayout(buttonPanelLayout);
+ //
+ // buttonPanelLayout.setHorizontalGroup(
+ // buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE).addComponent(saveButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton).addContainerGap()));
+ // buttonPanelLayout.setVerticalGroup(
+ // buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(saveButton).addComponent(cancelButton)));
+
+ contentPanel.validate();
+ }
+ });
+ }
- JLabel refIdLabel = new JLabel();
- refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- String refIdLabelPattern = messages.getString(MESSAGE_HASHDATA);
- refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{refId}));
+ private void showMultipleHashDataInputDialog(final TableModel signedReferences, final ActionListener cancelListener, final String cancelCommand, final ActionListener saveListener, final String saveCommand) {
+ SwingUtilities.invokeLater(new Runnable() {
- JScrollPane hashDataScrollPane = new JScrollPane();
- JTextArea hashDataTextArea = new JTextArea(text);
- hashDataTextArea.setEditable(false);
- hashDataTextArea.setColumns(1);
- hashDataTextArea.setRows(1);
- hashDataScrollPane.setViewportView(hashDataTextArea);
+ @Override
+ public void run() {
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
- GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
- mainPanel.setLayout(mainPanelLayout);
+ titleLabel.setText(messages.getString(TITLE_HASHDATA));
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(refIdLabel)
- .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addContainerGap());
+ JLabel refIdLabel = new JLabel();
+ refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ String refIdLabelPattern = messages.getString(MESSAGE_HASHDATALIST);
+ refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.getRowCount()}));
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createSequentialGroup()
- .addComponent(refIdLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(hashDataScrollPane, 0, GroupLayout.PREFERRED_SIZE, hashDataTextArea.getPreferredSize().height+3));
+ JTable hashDataTable = new JTable();
+ hashDataTable.setModel(signedReferences);
+ hashDataTable.setTableHeader(null);
+ // hashDataTable.setShowVerticalLines(false);
+ // hashDataTable.setRowSelectionAllowed(false);
+ TableColumn selectCol = hashDataTable.getColumnModel().getColumn(1);
+ selectCol.setMinWidth(CHECKBOX_WIDTH);
+ selectCol.setMaxWidth(CHECKBOX_WIDTH);
+
+
+ hashDataTable.setPreferredScrollableViewportSize(mainPanel.getPreferredSize());
-
-
-// GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
-// mainPanel.setLayout(mainPanelLayout);
-//
-// mainPanelLayout.setHorizontalGroup(
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(refIdLabel).addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE)).addContainerGap()));
-//
-// mainPanelLayout.setVerticalGroup(
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addComponent(refIdLabel).addGap(refIdLabel.getFont().getSize()).addComponent(hashDataScrollPane).addGap(refIdLabel.getFont().getSize())));
+ JScrollPane hashDataScrollPane = new JScrollPane(hashDataTable);
- backButton.setActionCommand(cancelCommand);
- backButton.addActionListener(cancelListener);
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
- saveButton.setActionCommand(saveCommand);
- saveButton.addActionListener(saveListener);
-
- GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
- buttonPanel.setLayout(buttonPanelLayout);
-
-// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
- buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createSequentialGroup()
- .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
- .addContainerGap());
- buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(saveButton)
- .addComponent(backButton));
-
-
-// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
-// buttonPanel.setLayout(buttonPanelLayout);
-//
-// buttonPanelLayout.setHorizontalGroup(
-// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE).addComponent(saveButton).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton).addContainerGap()));
-// buttonPanelLayout.setVerticalGroup(
-// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(saveButton).addComponent(cancelButton)));
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createSequentialGroup()
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(refIdLabel)
+ .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap());
- contentPanel.validate();
- }
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createSequentialGroup()
+ .addComponent(refIdLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(hashDataScrollPane, 0, GroupLayout.PREFERRED_SIZE, hashDataTable.getPreferredSize().height+3));
+ // .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED));
- private void showMultipleHashDataInputDialog(final TableModel signedReferences, final ActionListener cancelListener, final String cancelCommand, ActionListener saveListener, String saveCommand) {
- mainPanel.removeAll();
- buttonPanel.removeAll();
-
- titleLabel.setText(messages.getString(TITLE_HASHDATA));
-
- JLabel refIdLabel = new JLabel();
- refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- String refIdLabelPattern = messages.getString(MESSAGE_HASHDATALIST);
- refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.getRowCount()}));
-
- JTable hashDataTable = new JTable();
- hashDataTable.setModel(signedReferences);
- hashDataTable.setTableHeader(null);
-// hashDataTable.setShowVerticalLines(false);
-// hashDataTable.setRowSelectionAllowed(false);
- TableColumn selectCol = hashDataTable.getColumnModel().getColumn(1);
- selectCol.setMinWidth(CHECKBOX_WIDTH);
- selectCol.setMaxWidth(CHECKBOX_WIDTH);
-
-
- hashDataTable.setPreferredScrollableViewportSize(mainPanel.getPreferredSize());
-
- JScrollPane hashDataScrollPane = new JScrollPane(hashDataTable);
-
- GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
- mainPanel.setLayout(mainPanelLayout);
-
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(refIdLabel)
- .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addContainerGap());
-
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createSequentialGroup()
- .addComponent(refIdLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(hashDataScrollPane, 0, GroupLayout.PREFERRED_SIZE, hashDataTable.getPreferredSize().height+3));
-// .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED));
-
-
-//
-// GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
-// mainPanel.setLayout(mainPanelLayout);
-//
-// mainPanelLayout.setHorizontalGroup(
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
-// .addGroup(mainPanelLayout.createSequentialGroup()
-// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
-// .addComponent(refIdLabel)
-// .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE))
-// .addContainerGap()));
-//
-// mainPanelLayout.setVerticalGroup(
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
-// .addGroup(mainPanelLayout.createSequentialGroup()
-// .addComponent(refIdLabel)
-// .addGap(refIdLabel.getFont().getSize())
-// .addComponent(hashDataScrollPane)
-// .addGap(refIdLabel.getFont().getSize())));
-
-
-
-
-
-
-
-
-
-
-
-// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
-// buttonPanel.setLayout(buttonPanelLayout);
-//
-// buttonPanelLayout.setHorizontalGroup(
-// buttonPanelLayout.createSequentialGroup()
-//// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
-//// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
-// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-// .addComponent(saveButton)
-// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
-// .addComponent(cancelButton)
-// .addContainerGap()); //);
-// buttonPanelLayout.setVerticalGroup(
-// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
-// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
-// .addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
-// .addComponent(saveButton)
-// .addComponent(cancelButton))
-// .addContainerGap()));
+ //
+ // GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ // mainPanel.setLayout(mainPanelLayout);
+ //
+ // mainPanelLayout.setHorizontalGroup(
+ // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ // .addGroup(mainPanelLayout.createSequentialGroup()
+ // .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ // .addComponent(refIdLabel)
+ // .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, PREF_SIZE_PINFIELD, Short.MAX_VALUE))
+ // .addContainerGap()));
+ //
+ // mainPanelLayout.setVerticalGroup(
+ // mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ // .addGroup(mainPanelLayout.createSequentialGroup()
+ // .addComponent(refIdLabel)
+ // .addGap(refIdLabel.getFont().getSize())
+ // .addComponent(hashDataScrollPane)
+ // .addGap(refIdLabel.getFont().getSize())));
-
- backButton.setActionCommand(cancelCommand);
- backButton.addActionListener(cancelListener);
- saveButton.setActionCommand(saveCommand);
- saveButton.addActionListener(saveListener);
-
- GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
- buttonPanel.setLayout(buttonPanelLayout);
-
-// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
- buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createSequentialGroup()
- .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
- .addContainerGap());//);
- buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(saveButton)
- .addComponent(backButton));
-
- contentPanel.validate();
+
+
+
+
+
+
+
+
+
+
+ // GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+ // buttonPanel.setLayout(buttonPanelLayout);
+ //
+ // buttonPanelLayout.setHorizontalGroup(
+ // buttonPanelLayout.createSequentialGroup()
+ //// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ //// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
+ // .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ // .addComponent(saveButton)
+ // .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ // .addComponent(cancelButton)
+ // .addContainerGap()); //);
+ // buttonPanelLayout.setVerticalGroup(
+ // buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ // .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
+ // .addGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ // .addComponent(saveButton)
+ // .addComponent(cancelButton))
+ // .addContainerGap()));
+
+
+ JButton backButton = new JButton();
+ backButton.setText(messages.getString(BUTTON_BACK));
+ backButton.setActionCommand(cancelCommand);
+ backButton.addActionListener(cancelListener);
+
+ JButton saveButton = new JButton();
+ saveButton.setText(messages.getString(BUTTON_SAVE));
+ saveButton.setActionCommand(saveCommand);
+ saveButton.addActionListener(saveListener);
+
+ GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+ buttonPanel.setLayout(buttonPanelLayout);
+
+ // buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
+ buttonPanelLayout.setHorizontalGroup(
+ buttonPanelLayout.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap());//);
+ buttonPanelLayout.setVerticalGroup(
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(saveButton)
+ .addComponent(backButton));
+
+ contentPanel.validate();
+ }
+ });
}
- private void showSaveHashDataInputDialog(HashDataInput signedRef, ActionListener okListener, String okCommand) {
- String dir = System.getProperty("user.home");
- JFileChooser fileDialog = new JFileChooser(dir);
- fileDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
- fileDialog.setMultiSelectionEnabled(false);
- fileDialog.setDialogTitle(messages.getString(WINDOWTITLE_SAVE));
- fileDialog.setDialogType(JFileChooser.SAVE_DIALOG);
- fileDialog.setFileHidingEnabled(true);
- MimeFilter mimeFilter = new MimeFilter(signedRef.getMimeType());
- fileDialog.setFileFilter(mimeFilter);
- String filename = messages.getString(SAVE_HASHDATAINPUT_PREFIX) + mimeFilter.getExtension();
- fileDialog.setSelectedFile(new File(dir, filename));
- switch (fileDialog.showSaveDialog(contentPane)) {
+// private DisposableFileChooser fileDialog;
+
+ private void showSaveHashDataInputDialog(final List signedRefs, final ActionListener okListener, final String okCommand) {
+
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ String userHome = System.getProperty("user.home");
+
+ JFileChooser fileDialog = new JFileChooser(userHome);
+ fileDialog.setMultiSelectionEnabled(false);
+ fileDialog.setDialogType(JFileChooser.SAVE_DIALOG);
+ fileDialog.setFileHidingEnabled(true);
+ if (signedRefs.size() == 1) {
+ fileDialog.setDialogTitle(messages.getString(WINDOWTITLE_SAVE));
+ fileDialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
+ String mimeType = signedRefs.get(0).getMimeType();
+ MimeFilter mimeFilter = new MimeFilter(mimeType, messages);
+ fileDialog.setFileFilter(mimeFilter);
+ String filename = messages.getString(SAVE_HASHDATAINPUT_PREFIX) + MimeFilter.getExtension(mimeType);
+ fileDialog.setSelectedFile(new File(userHome, filename));
+ } else {
+ fileDialog.setDialogTitle(messages.getString(WINDOWTITLE_SAVEDIR));
+ fileDialog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ }
+
+ //parent contentPane -> placed over applet
+ switch (fileDialog.showSaveDialog(fileDialog)) {
case JFileChooser.APPROVE_OPTION:
- File f = fileDialog.getSelectedFile();
- if (f.exists()) {
-// log.debug("hashDataInput file exists, overwrite?");
- String ovrwrt = messages.getString(MESSAGE_OVERWRITE);
- int overwrite = JOptionPane.showConfirmDialog(contentPane, MessageFormat.format(ovrwrt, filename), messages.getString(WINDOWTITLE_OVERWRITE), JOptionPane.OK_CANCEL_OPTION);
- if (overwrite != JOptionPane.OK_OPTION) {
-// log.debug("User canceled overwrite HashDataInput, returning to SignaturePin dialog");
- okListener.actionPerformed(new ActionEvent(fileDialog, ActionEvent.ACTION_PERFORMED, okCommand));
- return;
- }
+ File f = fileDialog.getSelectedFile();
+ for (HashDataInput hashDataInput : signedRefs) {
+ String mimeType = hashDataInput.getMimeType();
+ String id = hashDataInput.getReferenceId();
+ File file;
+ if (f.isDirectory()) {
+ String filename = messages.getString(SAVE_HASHDATAINPUT_PREFIX) + '_' + id + MimeFilter.getExtension(mimeType);
+ file = new File(f, filename);
+ } else {
+ file = f;
+ }
+ if (file.exists()) {
+ String ovrwrt = messages.getString(MESSAGE_OVERWRITE);
+ int overwrite = JOptionPane.showConfirmDialog(fileDialog, MessageFormat.format(ovrwrt, file), messages.getString(WINDOWTITLE_OVERWRITE), JOptionPane.OK_CANCEL_OPTION);
+ if (overwrite != JOptionPane.OK_OPTION) {
+ continue;
+ }
}
if (log.isDebugEnabled()) {
- log.debug("Writing HashDataInput " + signedRef.getReferenceId() + " (" + signedRef.getMimeType() + ") to file " + f);
+ log.debug("Writing HashDataInput " + id + " (" + mimeType + ") to file " + file);
}
FileOutputStream fos = null;
try {
- fos = new FileOutputStream(f);
+ fos = new FileOutputStream(file);
BufferedOutputStream bos = new BufferedOutputStream(fos);
- InputStream hdi = signedRef.getHashDataInput();
+ InputStream hdi = hashDataInput.getHashDataInput();
int b;
while ((b = hdi.read()) != -1) {
bos.write(b);
@@ -1134,7 +1200,7 @@ public class BKUGUI implements BKUGUIFacade {
bos.flush();
bos.close();
} catch (IOException ex) {
- log.error("Failed to write HashDataInput to file " + f + ": " + ex.getMessage());
+ log.error("Failed to write HashDataInput to file " + file + ": " + ex.getMessage());
showErrorDialog("Failed to write signed reference to file: " + ex.getMessage(), null, null);
ex.printStackTrace();
} finally {
@@ -1142,11 +1208,15 @@ public class BKUGUI implements BKUGUIFacade {
fos.close();
} catch (IOException ex) {
}
- }
+ }
+ }
+ }
+ log.debug("done saving hashdatainput");
+ okListener.actionPerformed(new ActionEvent(fileDialog, ActionEvent.ACTION_PERFORMED, okCommand));
}
- okListener.actionPerformed(new ActionEvent(fileDialog, ActionEvent.ACTION_PERFORMED, okCommand));
+ });
}
-
+
@Override
public void showWaitDialog(final String waitMessage) {
SwingUtilities.invokeLater(new Runnable() {
@@ -1190,149 +1260,4 @@ public class BKUGUI implements BKUGUIFacade {
return null;
}
- class PINDocument extends PlainDocument {
-
- private PINSpec pinSpec;
- private Pattern pinPattern;
- private JButton enterButton;
-
- public PINDocument(PINSpec pinSpec, JButton enterButton) {
- this.pinSpec = pinSpec;
- if (pinSpec.getRexepPattern() != null) {
- pinPattern = Pattern.compile(pinSpec.getRexepPattern());
- } else {
- pinPattern = Pattern.compile(".");
- }
- this.enterButton = enterButton;
- }
-
- @Override
- public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
- if (pinSpec.getMaxLength() >= (getLength() + str.length())) {
- boolean matches = true;
- for (int i = 0; i < str.length(); i++) {
- Matcher m = pinPattern.matcher(str.substring(i, i + 1));
- if (!m.matches()) {
- matches = false;
- }
- }
- if (matches) {
- super.insertString(offs, str, a);
- }
- }
- enterButton.setEnabled(getLength() >= pinSpec.getMinLength());
- }
-
- @Override
- public void remove(int offs, int len) throws BadLocationException {
- super.remove(offs, len);
- enterButton.setEnabled(getLength() >= pinSpec.getMinLength());
- }
- }
-
- class MimeFilter extends FileFilter {
-
- protected String mimeType;
-
- public MimeFilter(String mimeType) {
- this.mimeType = mimeType;
- }
-
- @Override
- public boolean accept(File f) {
-
- if (f.isDirectory()) {
- return true;
- }
-
- String ext = getExtension(f);
- if ("text/xml".equals(mimeType)) {
- return "xml".equalsIgnoreCase(ext);
- } else if ("text/html".equals(mimeType)) {
- return "html".equalsIgnoreCase(ext) || "htm".equalsIgnoreCase(ext);
- } else if ("application/xhtml+xml".equals(mimeType)) {
- return "xhtml".equalsIgnoreCase(ext);
- } else if ("text/plain".equals(mimeType)) {
- return "txt".equalsIgnoreCase(ext);
- } else if ("application/pdf".equals(mimeType)) {
- return "pdf".equalsIgnoreCase(ext);
- } else {
- return true;
- }
- }
-
- private String getExtension(File f) {
- String ext = null;
- String s = f.getName();
- int i = s.lastIndexOf('.');
-
- if (i > 0 && i < s.length() - 1) {
- ext = s.substring(i + 1).toLowerCase();
- }
- return ext;
- }
-
- @Override
- public String getDescription() {
- if ("text/xml".equals(mimeType)) {
- return messages.getString(MIMETYPE_DESC_XML);
- } else if ("text/html".equals(mimeType)) {
- return messages.getString(MIMETYPE_DESC_HTML);
- } else if ("application/xhtml+xml".equals(mimeType)) {
- return messages.getString(MIMETYPE_DESC_XHTML);
- } else if ("text/plain".equals(mimeType)) {
- return messages.getString(MIMETYPE_DESC_TXT);
- } else if ("application/pdf".equals(mimeType)) {
- return messages.getString(MIMETYPE_DESC_PDF);
- } else {
- return messages.getString(MIMETYPE_DESC_BIN);
- }
- }
-
- public String getExtension() {
- if ("text/xml".equals(mimeType)) {
- return ".xml";
- } else if ("text/html".equals(mimeType)) {
- return ".html";
- } else if ("application/xhtml+xml".equals(mimeType)) {
- return ".xhtml";
- } else if ("text/plain".equals(mimeType)) {
- return ".txt";
- } else if ("application/pdf".equals(mimeType)) {
- return ".pdf";
- } else {
- return ".bin";
- }
- }
- }
-
- class HashDataTableModel extends DefaultTableModel {
-
- Class[] types = new Class[]{
- java.lang.String.class, java.lang.Boolean.class
- };
-
- public HashDataTableModel(List signedReferences) {
- super(0, 2);
- for (HashDataInput hashDataInput : signedReferences) {
- addRow(new Object[]{hashDataInput.getReferenceId(), new Boolean(true)});
- }
- }
-
- @Override
- public Class getColumnClass(int columnIndex) {
- return types [columnIndex];
- }
-
- public List getSelectedReferenceIds() {
- ArrayList selection = new ArrayList();
- for (Object row : dataVector) {
- if ((Boolean) ((Vector) row).elementAt(1)) {
- selection.add((String) ((Vector) row).elementAt(0));
- }
- }
- return selection;
- }
-
- }
}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index f8b80556..f4b6325d 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -53,6 +53,8 @@ public interface BKUGUIFacade {
public void showHashDataInputDialog(List signedReferences, ActionListener okListener, String actionCommand);
+// public void showPlainTextHashDataInputDialog(String text, ActionListener saveListener, String saveCommand, ActionListener cancelListener, String cancelCommand);
+
public void showErrorDialog(String errorMsg, ActionListener okListener, String actionCommand);
public void showErrorDialog(String errorMsg);
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
new file mode 100644
index 00000000..061a2849
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.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.stal.HashDataInput;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+import javax.swing.table.DefaultTableModel;
+
+/**
+ *
+ * @author clemens
+ */
+class HashDataTableModel extends DefaultTableModel {
+
+ protected List signedReferences;
+
+ Class[] types = new Class[]{
+ java.lang.String.class, java.lang.Boolean.class
+ };
+
+ public HashDataTableModel(List signedReferences) {
+ super(0, 2);
+ this.signedReferences = signedReferences;
+ for (HashDataInput hashDataInput : signedReferences) {
+ String desc = hashDataInput.getReferenceId() + " (" + hashDataInput.getMimeType() + ")";
+ addRow(new Object[]{desc, new Boolean(true)});
+ }
+ }
+
+ @Override
+ public Class getColumnClass(int columnIndex) {
+ return types [columnIndex];
+ }
+
+ public List getSelectedHashData() {
+ ArrayList selection = new ArrayList();
+ for (int i = 0; i < dataVector.size(); i++) {
+ if ((Boolean) ((Vector) dataVector.get(i)).elementAt(1)) {
+ selection.add(signedReferences.get(i));
+ }
+ }
+ return selection;
+ }
+
+// public List getSelectedReferenceIds() {
+// ArrayList selection = new ArrayList();
+// for (Object row : dataVector) {
+// if ((Boolean) ((Vector) row).elementAt(1)) {
+// selection.add((String) ((Vector) row).elementAt(0));
+// }
+// }
+// return selection;
+// }
+
+ }
\ No newline at end of file
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/MimeFilter.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/MimeFilter.java
new file mode 100644
index 00000000..6ee61a82
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/MimeFilter.java
@@ -0,0 +1,98 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package at.gv.egiz.bku.gui;
+
+import java.io.File;
+import java.util.ResourceBundle;
+import javax.swing.filechooser.FileFilter;
+
+/**
+ *
+ * @author clemens
+ */
+class MimeFilter extends FileFilter {
+
+ private static final String MIMETYPE_DESC_XML = "mimetype.desc.xml";
+ private static final String MIMETYPE_DESC_HTML = "mimetype.desc.html";
+ private static final String MIMETYPE_DESC_XHTML = "mimetype.desc.xhtml";
+ private static final String MIMETYPE_DESC_TXT = "mimetype.desc.txt";
+ private static final String MIMETYPE_DESC_PDF = "mimetype.desc.pdf";
+ private static final String MIMETYPE_DESC_BIN = "mimetype.desc.bin";
+
+ protected String mimeType;
+ protected ResourceBundle messages;
+
+ public MimeFilter(String mimeType, ResourceBundle messages) {
+ this.mimeType = mimeType;
+ this.messages = messages;
+ }
+
+ @Override
+ public boolean accept(File f) {
+
+ if (f.isDirectory()) {
+ return true;
+ }
+
+ String ext = getExtension(f);
+ if ("text/xml".equals(mimeType)) {
+ return "xml".equalsIgnoreCase(ext);
+ } else if ("text/html".equals(mimeType)) {
+ return "html".equalsIgnoreCase(ext) || "htm".equalsIgnoreCase(ext);
+ } else if ("application/xhtml+xml".equals(mimeType)) {
+ return "xhtml".equalsIgnoreCase(ext);
+ } else if ("text/plain".equals(mimeType)) {
+ return "txt".equalsIgnoreCase(ext);
+ } else if ("application/pdf".equals(mimeType)) {
+ return "pdf".equalsIgnoreCase(ext);
+ } else {
+ return true;
+ }
+ }
+
+ private String getExtension(File f) {
+ String ext = null;
+ String s = f.getName();
+ int i = s.lastIndexOf('.');
+
+ if (i > 0 && i < s.length() - 1) {
+ ext = s.substring(i + 1).toLowerCase();
+ }
+ return ext;
+ }
+
+ @Override
+ public String getDescription() {
+ if ("text/xml".equals(mimeType)) {
+ return messages.getString(MIMETYPE_DESC_XML);
+ } else if ("text/html".equals(mimeType)) {
+ return messages.getString(MIMETYPE_DESC_HTML);
+ } else if ("application/xhtml+xml".equals(mimeType)) {
+ return messages.getString(MIMETYPE_DESC_XHTML);
+ } else if ("text/plain".equals(mimeType)) {
+ return messages.getString(MIMETYPE_DESC_TXT);
+ } else if ("application/pdf".equals(mimeType)) {
+ return messages.getString(MIMETYPE_DESC_PDF);
+ } else {
+ return messages.getString(MIMETYPE_DESC_BIN);
+ }
+ }
+
+ public static String getExtension(String mimeType) {
+ if ("text/xml".equals(mimeType)) {
+ return ".xml";
+ } else if ("text/html".equals(mimeType)) {
+ return ".html";
+ } else if ("application/xhtml+xml".equals(mimeType)) {
+ return ".xhtml";
+ } else if ("text/plain".equals(mimeType)) {
+ return ".txt";
+ } else if ("application/pdf".equals(mimeType)) {
+ return ".pdf";
+ } else {
+ return ".bin";
+ }
+ }
+}
\ No newline at end of file
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java
new file mode 100644
index 00000000..e8572742
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java
@@ -0,0 +1,58 @@
+/*
+ * 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 java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.swing.JButton;
+import javax.swing.text.AttributeSet;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.PlainDocument;
+
+/**
+ *
+ * @author clemens
+ */
+class PINDocument extends PlainDocument {
+
+ private PINSpec pinSpec;
+ private Pattern pinPattern;
+ private JButton enterButton;
+
+ public PINDocument(PINSpec pinSpec, JButton enterButton) {
+ this.pinSpec = pinSpec;
+ if (pinSpec.getRexepPattern() != null) {
+ pinPattern = Pattern.compile(pinSpec.getRexepPattern());
+ } else {
+ pinPattern = Pattern.compile(".");
+ }
+ this.enterButton = enterButton;
+ }
+
+ @Override
+ public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
+ if (pinSpec.getMaxLength() >= (getLength() + str.length())) {
+ boolean matches = true;
+ for (int i = 0; i < str.length(); i++) {
+ Matcher m = pinPattern.matcher(str.substring(i, i + 1));
+ if (!m.matches()) {
+ matches = false;
+ }
+ }
+ if (matches) {
+ super.insertString(offs, str, a);
+ }
+ }
+ enterButton.setEnabled(getLength() >= pinSpec.getMinLength());
+ }
+
+ @Override
+ public void remove(int offs, int len) throws BadLocationException {
+ super.remove(offs, len);
+ enterButton.setEnabled(getLength() >= pinSpec.getMinLength());
+ }
+ }
\ No newline at end of file
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index b651fa8d..a329ba86 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -23,6 +23,7 @@ title.retry=Falscher PIN
title.wait=Bitte warten
title.hashdata=Signaturdaten
windowtitle.save=Signaturdaten speichern
+windowtitle.savedir=Signaturdaten in Verzeichnis speichern
windowtitle.overwrite=Datei \u00FCberschreiben?
message.wait=Bitte warten...
message.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken
@@ -34,16 +35,16 @@ message.retries=Noch {0} Versuche
message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?
label.pin={0}:
label.pinsize=({0} stellig)
-error.hashdata=Keine Signaturdaten verf\u00FCgbar
+error.no.hashdata=Keine Signaturdaten verf\u00FCgbar
button.ok=OK
button.cancel=Abbrechen
button.back=Zur\u00FCck
button.sign=Signieren
button.save=Speichern...
-mimetype.desc.xml=XML-Dateien (*.xml)
-mimetype.desc.html=HTML-Dateien (*.html, *.htm)
-mimetype.desc.xhtml=XHTML-Dateien (*.xhtml)
-mimetype.desc.txt=Textdateien (*.txt)
-mimetype.desc.pdf=Adobe PDF-Dateien (*.pdf)
-mimetype.desc.bin=Bin\u00E4rdateien (*.bin)
+mimetype.desc.xml=XML-Dateien (.xml)
+mimetype.desc.html=HTML-Dateien (.html, .htm)
+mimetype.desc.xhtml=XHTML-Dateien (.xhtml)
+mimetype.desc.txt=Textdateien (.txt)
+mimetype.desc.pdf=Adobe PDF-Dateien (.pdf)
+mimetype.desc.bin=Bin\u00E4rdateien (.bin)
save.hashdatainput.prefix=Signaturdaten
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index 4367f642..85f05435 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -1,19 +1,19 @@
/*
-* 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.
-*/
+ * 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.
@@ -35,137 +35,137 @@ import java.util.List;
*/
public class BKUGUIWorker implements Runnable {
- BKUGUIFacade gui;
+ BKUGUIFacade gui;
- public void init(BKUGUIFacade gui) {
- this.gui = gui;
- }
+ public void init(BKUGUIFacade gui) {
+ this.gui = gui;
+ }
- @Override
- public void run() {
+ @Override
+ public void run() {
// try {
- final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN");
-
-
- 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, signListener, "sign", cancelListener, "cancel", null, "hashdata");
- }
- };
- HashDataInput signedRef1 = new HashDataInput() {
-
- @Override
- public InputStream getHashDataInput() {
- return new ByteArrayInputStream("HashDataInput_001\n12345\n\tHello, world!\n12345\n\n12345\n6789\nblabla".getBytes());
- }
-
- @Override
- public String getMimeType() {
- return "text/plain";
- }
-
- @Override
- public String getReferenceId() {
- return "Reference-ref1-00000000000000000000001";
- }
- };
- HashDataInput signedRef2 = new HashDataInput() {
-
- @Override
- public InputStream getHashDataInput() {
- return new ByteArrayInputStream("HashDataInput_002 ".getBytes());
- }
-
- @Override
- public String getMimeType() {
- return "text/xml";
- }
-
- @Override
- public String getReferenceId() {
- return "Reference-ref2-00000000000000000000002";
- }
- };
- HashDataInput signedRef3 = new HashDataInput() {
-
- @Override
- public InputStream getHashDataInput() {
- return new ByteArrayInputStream("HashDataInput_003 ".getBytes());
- }
-
- @Override
- public String getMimeType() {
- return "text/xml";
- }
-
- @Override
- public String getReferenceId() {
- return "Reference-ref3-00000000000000000000003";
- }
- };
- HashDataInput signedRef4 = new HashDataInput() {
-
- @Override
- public InputStream getHashDataInput() {
- return new ByteArrayInputStream("HashDataInput_004 ".getBytes());
- }
-
- @Override
- public String getMimeType() {
- return "text/xml";
- }
-
- @Override
- public String getReferenceId() {
- return "ref4";
- }
- };
-
- //
- List signedRefs = new ArrayList();
- signedRefs.add(signedRef1);
+ final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN");
+
+
+ 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, signListener, "sign", cancelListener, "cancel", null, "hashdata");
+ }
+ };
+ HashDataInput signedRef1 = new HashDataInput() {
+
+ @Override
+ public InputStream getHashDataInput() {
+ return new ByteArrayInputStream("oialfx HashDataInput_001\n12345\n\tHello, world!\n12345\n\n12345\n6789\nblabla".getBytes());
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/plain";
+ }
+
+ @Override
+ public String getReferenceId() {
+ return "Reference-ref1-00000000000000000000001";
+ }
+ };
+ HashDataInput signedRef2 = new HashDataInput() {
+
+ @Override
+ public InputStream getHashDataInput() {
+ return new ByteArrayInputStream("HashDataInput_002 ".getBytes());
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/xml";
+ }
+
+ @Override
+ public String getReferenceId() {
+ return "Reference-ref2-00000000000000000000002";
+ }
+ };
+ HashDataInput signedRef3 = new HashDataInput() {
+
+ @Override
+ public InputStream getHashDataInput() {
+ return new ByteArrayInputStream("HashDataInput_003 ".getBytes());
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/xml";
+ }
+
+ @Override
+ public String getReferenceId() {
+ return "Reference-ref3-00000000000000000000003";
+ }
+ };
+ HashDataInput signedRef4 = new HashDataInput() {
+
+ @Override
+ public InputStream getHashDataInput() {
+ return new ByteArrayInputStream("HashDataInput_004 ".getBytes());
+ }
+
+ @Override
+ public String getMimeType() {
+ return "text/xml";
+ }
+
+ @Override
+ public String getReferenceId() {
+ return "ref4";
+ }
+ };
+
+ //
+ List signedRefs = new ArrayList();
+ signedRefs.add(signedRef1);
signedRefs.add(signedRef2);
signedRefs.add(signedRef3);
signedRefs.add(signedRef4);
// signedRefs = Collections.singletonList(signedRef1);
- gui.showHashDataInputDialog(signedRefs, returnListener, "return");
- }
- };
-
+ gui.showHashDataInputDialog(signedRefs, returnListener, "return");
+ }
+ };
+
// gui.showWelcomeDialog();
//
// Thread.sleep(2000);
-
+
// gui.showInsertCardDialog(cancelListener, "cancel");
-
+
// Thread.sleep(2000);
//
// gui.showCardNotSupportedDialog(cancelListener, "cancel");
@@ -178,11 +178,11 @@ public class BKUGUIWorker implements Runnable {
//
// Thread.sleep(2000);
//
-
- gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
+
+ gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
// Thread.sleep(2000);
-
+
// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
//
// Thread.sleep(2000);
@@ -192,13 +192,13 @@ public class BKUGUIWorker implements Runnable {
// Thread.sleep(2000);
//
// gui.showErrorDialog("Testfehler occured");
-
-
+
+
// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save");
// Thread.sleep(2000);
// } catch (InterruptedException ex) {
// ex.printStackTrace();
// }
- }
+ }
}
diff --git a/BKUOnline/pom.xml b/BKUOnline/pom.xml
index d31367a8..a50954cd 100644
--- a/BKUOnline/pom.xml
+++ b/BKUOnline/pom.xml
@@ -58,11 +58,13 @@
1.0-SNAPSHOT
compile
-
+
+
+ at.gv.egiz
+ BKUApplet
+ 1.0-SNAPSHOT
+ provided
+
@@ -177,4 +179,5 @@
+>>>>>>> .r33
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
index 1f84300a..d37d0551 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
@@ -47,6 +47,8 @@ import at.gv.egiz.stal.signedinfo.ObjectFactory;
import at.gv.egiz.stal.signedinfo.ReferenceType;
import at.gv.egiz.stal.signedinfo.SignedInfoType;
import at.gv.egiz.stal.util.JCEAlgorithmNames;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
@@ -150,9 +152,6 @@ public class SignRequestHandler extends AbstractRequestHandler implements
hashDataInputs = getHashDataInputs(signedInfo.getReference());
}
gui.showHashDataInputDialog(hashDataInputs, this, "ok");
- waitForAction();
- gui.showSignaturePINDialog(spec, this, "sign", this, "cancel", this,
- "hashData");
} catch (Exception ex) {
//FIXME localize messages
log.error("Failed to obtain HashDataInputs: " + ex.getMessage());
@@ -178,6 +177,7 @@ public class SignRequestHandler extends AbstractRequestHandler implements
/**
* override by subclass
+ * @post-condition returned list != null
* @return
*/
protected List getHashDataInputs(List signedReferences) throws Exception {
--
cgit v1.2.3
From a288c99fa6955a2c9055b28dc1c805dacbe5fc93 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Mon, 15 Sep 2008 18:02:18 +0000
Subject: encoding
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@40 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 262 ++++++++++++++-------
.../at/gv/egiz/bku/gui/HashDataTableModel.java | 94 ++++----
.../main/java/at/gv/egiz/bku/gui/MimeFilter.java | 18 +-
.../main/java/at/gv/egiz/bku/gui/PinDocument.java | 19 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 2 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 24 +-
6 files changed, 275 insertions(+), 144 deletions(-)
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
index 584dba1a..5fb67982 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
@@ -23,10 +23,8 @@ package at.gv.egiz.bku.gui;
import at.gv.egiz.smcc.PINSpec;
import at.gv.egiz.stal.HashDataInput;
import java.awt.Color;
-import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
-import java.awt.Dimension;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -39,13 +37,10 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.text.MessageFormat;
-import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
-import java.util.Vector;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import java.util.StringTokenizer;
import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
@@ -59,15 +54,10 @@ import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.LayoutStyle;
+import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
-import javax.swing.border.TitledBorder;
-import javax.swing.filechooser.FileFilter;
-import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
-import javax.swing.text.AttributeSet;
-import javax.swing.text.BadLocationException;
-import javax.swing.text.PlainDocument;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -154,6 +144,7 @@ public class BKUGUI implements BKUGUIFacade {
SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
public void run() {
initIconPanel();
@@ -285,6 +276,7 @@ public class BKUGUI implements BKUGUIFacade {
public void showLoginDialog(ActionListener loginListener, String actionCommand) {
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
mainPanel.removeAll();
buttonPanel.removeAll();
@@ -318,6 +310,7 @@ public class BKUGUI implements BKUGUIFacade {
public void showWelcomeDialog() {
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
mainPanel.removeAll();
buttonPanel.removeAll();
@@ -352,6 +345,7 @@ public class BKUGUI implements BKUGUIFacade {
public void showInsertCardDialog(final ActionListener cancelListener, final String cancelCommand) {
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
mainPanel.removeAll();
buttonPanel.removeAll();
@@ -388,6 +382,7 @@ public class BKUGUI implements BKUGUIFacade {
public void showCardNotSupportedDialog(final ActionListener cancelListener, final String cancelCommand) {
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
mainPanel.removeAll();
buttonPanel.removeAll();
@@ -440,6 +435,7 @@ public class BKUGUI implements BKUGUIFacade {
private void showCardPINDialog(final PINSpec pinSpec, final int numRetries, final ActionListener okListener, final String okCommand, final ActionListener cancelListener, final String cancelCommand) {
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
mainPanel.removeAll();
@@ -599,6 +595,7 @@ public class BKUGUI implements BKUGUIFacade {
private void showSignaturePINDialog(final PINSpec pinSpec, final int numRetries, final ActionListener signListener, final String signCommand, final ActionListener cancelListener, final String cancelCommand, final ActionListener hashdataListener, final String hashdataCommand) {
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
mainPanel.removeAll();
buttonPanel.removeAll();
@@ -763,6 +760,7 @@ public class BKUGUI implements BKUGUIFacade {
public void showErrorDialog(final String errorMsg, final ActionListener okListener, final String okCommand) {
SwingUtilities.invokeLater(new Runnable() {
+ @Override
public void run() {
mainPanel.removeAll();
buttonPanel.removeAll();
@@ -845,6 +843,50 @@ public class BKUGUI implements BKUGUIFacade {
});
}
+ @Override
+ public void showWaitDialog(final String waitMessage) {
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
+
+ titleLabel.setText(messages.getString(TITLE_WAIT));
+
+ JLabel waitMsgLabel = new JLabel();
+ waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ if (waitMessage != null) {
+ waitMsgLabel.setText("" + waitMessage + "");
+ } else {
+ waitMsgLabel.setText("" + messages.getString(MESSAGE_WAIT) + "");
+ }
+
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
+
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createSequentialGroup()
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(waitMsgLabel)
+ .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(waitMsgLabel));
+
+ contentPanel.validate();
+ }
+ });
+ }
+
+ @Override
+ public char[] getPin() {
+ if (pinField != null) {
+ return pinField.getPassword();
+ }
+ return null;
+ }
+
@Override
public void showHashDataInputDialog(final List signedReferences, final ActionListener okListener, final String okCommand) {
@@ -891,32 +933,6 @@ public class BKUGUI implements BKUGUIFacade {
}
}
- private static String getText(HashDataInput hdi) {
- ByteArrayOutputStream baos = null;
- try {
- InputStream hashDataIS = hdi.getHashDataInput();
- if (hashDataIS == null) {
- log.error("No HashDataInput stream for reference " + hdi.getReferenceId());
- return null;
- } else {
- baos = new ByteArrayOutputStream(hashDataIS.available());
- int c;
- while ((c = hashDataIS.read()) != -1) {
- baos.write(c);
- }
- return baos.toString("UTF-8");
- }
- } catch (IOException ex) {
- log.error("Failed to read HashDataInput for reference " + hdi.getReferenceId() + ": " + ex.getMessage());
- return null;
- } finally {
- try {
- baos.close();
- } catch (IOException ex) {
- }
- }
- }
-
private void showPlainTextHashDataInputDialog(final String hashDataText, final ActionListener saveListener, final String saveCommand, final ActionListener cancelListener, final String cancelCommand) {
SwingUtilities.invokeLater(new Runnable() {
@@ -931,13 +947,16 @@ public class BKUGUI implements BKUGUIFacade {
refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
refIdLabel.setText(messages.getString(MESSAGE_HASHDATA)); //MessageFormat.format(refIdLabelPattern, new Object[]{refId}));
- JScrollPane hashDataScrollPane = new JScrollPane();
JTextArea hashDataTextArea = new JTextArea(hashDataText);
hashDataTextArea.setEditable(false);
- hashDataTextArea.setColumns(1);
- hashDataTextArea.setRows(1);
+// hashDataTextArea.setColumns(1);
+// hashDataTextArea.setRows(1);
hashDataTextArea.setFont(new Font(HASHDATA_FONT, hashDataTextArea.getFont().getStyle(), hashDataTextArea.getFont().getSize()));
- hashDataScrollPane.setViewportView(hashDataTextArea);
+// hashDataScrollPane.setViewportView(hashDataTextArea);
+// hashDataScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); //HORIZONTAL_SCROLLBAR_NEVER);
+
+
+ JScrollPane hashDataScrollPane = new JScrollPane(hashDataTextArea);
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
@@ -946,16 +965,14 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.createSequentialGroup()
.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(refIdLabel)
- .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE))
.addContainerGap());
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
.addComponent(refIdLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(hashDataScrollPane, 0, GroupLayout.PREFERRED_SIZE, hashDataTextArea.getPreferredSize().height+3));
-
-
+ .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
// GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
// mainPanel.setLayout(mainPanelLayout);
@@ -1031,7 +1048,7 @@ public class BKUGUI implements BKUGUIFacade {
selectCol.setMaxWidth(CHECKBOX_WIDTH);
- hashDataTable.setPreferredScrollableViewportSize(mainPanel.getPreferredSize());
+// hashDataTable.setPreferredScrollableViewportSize(mainPanel.getPreferredSize());
JScrollPane hashDataScrollPane = new JScrollPane(hashDataTable);
@@ -1042,14 +1059,14 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.createSequentialGroup()
.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(refIdLabel)
- .addComponent(hashDataScrollPane, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)) // GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap());
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
.addComponent(refIdLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(hashDataScrollPane, 0, GroupLayout.PREFERRED_SIZE, hashDataTable.getPreferredSize().height+3));
+ .addComponent(hashDataScrollPane, 0, 0, hashDataTable.getPreferredSize().height+3));
// .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED));
@@ -1217,47 +1234,112 @@ public class BKUGUI implements BKUGUIFacade {
});
}
- @Override
- public void showWaitDialog(final String waitMessage) {
- SwingUtilities.invokeLater(new Runnable() {
-
- public void run() {
- mainPanel.removeAll();
- buttonPanel.removeAll();
-
- titleLabel.setText(messages.getString(TITLE_WAIT));
-
- JLabel waitMsgLabel = new JLabel();
- waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- if (waitMessage != null) {
- waitMsgLabel.setText("" + waitMessage + "");
- } else {
- waitMsgLabel.setText("" + messages.getString(MESSAGE_WAIT) + "");
- }
-
- GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
- mainPanel.setLayout(mainPanelLayout);
-
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(waitMsgLabel)
- .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(waitMsgLabel));
-
- contentPanel.validate();
- }
- });
- }
-
- @Override
- public char[] getPin() {
- if (pinField != null) {
- return pinField.getPassword();
+ private static String getText(HashDataInput hdi) {
+ ByteArrayOutputStream baos = null;
+ try {
+ InputStream hashDataIS = hdi.getHashDataInput();
+ if (hashDataIS == null) {
+ log.error("No HashDataInput stream for reference " + hdi.getReferenceId());
+ return null;
+ } else {
+ baos = new ByteArrayOutputStream(hashDataIS.available());
+ int c;
+ while ((c = hashDataIS.read()) != -1) {
+ baos.write(c);
+ }
+ String encoding = hdi.getEncoding();
+ if (encoding == null) {
+ //default for URL-encoded
+ encoding = "UTF-8";
+ }
+ return baos.toString(encoding);
}
- return null;
+ } catch (IOException ex) {
+ log.error("Failed to read HashDataInput for reference " + hdi.getReferenceId() + ": " + ex.getMessage());
+ return null;
+ } finally {
+ try {
+ baos.close();
+ } catch (IOException ex) {
+ }
+ }
}
-
+
+// private String parseToken(final char[] terminators) {
+// char ch;
+// i1 = pos;
+// i2 = pos;
+// while (hasChar()) {
+// ch = chars[pos];
+// if (isOneOf(ch, terminators)) {
+// break;
+// }
+// i2++;
+// pos++;
+// }
+// return getToken(false);
+// }
+
+// private static String getCharset(String contentType) {
+//
+// StringTokenizer t = new StringTokenizer
+//
+// if (contentType == null) {
+// return "UTF-8";
+// }
+//
+// int pos = 0;
+// int len = contentType.length();
+//
+// while (pos < len) {
+// pos++;
+// String paramName = parseToken(new char[] {
+// '=', separator });
+// }
+//
+// HashMap params = new HashMap();
+// this.chars = chars;
+// this.pos = offset;
+// this.len = length;
+//
+// String paramName = null;
+// String paramValue = null;
+// while (hasChar()) {
+// paramName = parseToken(new char[] {
+// '=', separator });
+// paramValue = null;
+// if (hasChar() && (chars[pos] == '=')) {
+// pos++; // skip '='
+// paramValue = parseQuotedToken(new char[] {
+// separator });
+// }
+// if (hasChar() && (chars[pos] == separator)) {
+// pos++; // skip separator
+// }
+// if ((paramName != null) && (paramName.length() > 0)) {
+// if (this.lowerCaseNames) {
+// paramName = paramName.toLowerCase();
+// }
+// params.put(paramName, paramValue);
+// }
+// }
+// return params;
+//
+//
+//
+// Parser
+// ParameterParser pf = new ParameterParser();
+// pf.setLowerCaseNames(true);
+// Map map = pf.parse(contentType, SEPERATOR);
+// String retVal = (String) map.get(CHAR_SET);
+// if ((retVal == null) && (replaceNullWithDefault)) {
+// if (map.containsKey(APPLICATION_URL_ENCODED)) {
+// // default charset for url encoded data
+// return "UTF-8";
+// }
+// retVal = getDefaultCharset();
+// }
+// return retVal;
+// }
+
}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
index 061a2849..1a833f48 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
@@ -1,19 +1,19 @@
/*
-* 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.
-*/
+ * 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.stal.HashDataInput;
@@ -28,37 +28,42 @@ import javax.swing.table.DefaultTableModel;
*/
class HashDataTableModel extends DefaultTableModel {
- protected List signedReferences;
-
- Class[] types = new Class[]{
- java.lang.String.class, java.lang.Boolean.class
- };
-
- public HashDataTableModel(List signedReferences) {
- super(0, 2);
- this.signedReferences = signedReferences;
- for (HashDataInput hashDataInput : signedReferences) {
- String desc = hashDataInput.getReferenceId() + " (" + hashDataInput.getMimeType() + ")";
- addRow(new Object[]{desc, new Boolean(true)});
- }
- }
+ protected List signedReferences;
+
+ protected Class[] types = new Class[]{
+ java.lang.String.class, java.lang.Boolean.class
+ };
- @Override
- public Class getColumnClass(int columnIndex) {
- return types [columnIndex];
- }
+ public HashDataTableModel(List signedReferences) {
+ super(0, 2);
+ this.signedReferences = signedReferences;
+ for (HashDataInput hashDataInput : signedReferences) {
+ String desc = hashDataInput.getReferenceId() + " (" + hashDataInput.getMimeType() + ")";
+ addRow(new Object[]{desc, new Boolean(true)});
+ }
+ }
- public List getSelectedHashData() {
- ArrayList selection = new ArrayList();
- for (int i = 0; i < dataVector.size(); i++) {
- if ((Boolean) ((Vector) dataVector.get(i)).elementAt(1)) {
- selection.add(signedReferences.get(i));
- }
- }
- return selection;
- }
+ @Override
+ public Class getColumnClass(int columnIndex) {
+ return types[columnIndex];
+ }
-// public List getSelectedReferenceIds() {
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ if (columnIndex == 1)
+ return true;
+ return false;
+ }
+
+ public List getSelectedHashData() {
+ ArrayList selection = new ArrayList();
+ for (int i = 0; i < dataVector.size(); i++) {
+ if ((Boolean) ((Vector) dataVector.get(i)).elementAt(1)) {
+ selection.add(signedReferences.get(i));
+ }
+ }
+ return selection;
+ }// public List getSelectedReferenceIds() {
// ArrayList selection = new ArrayList();
// for (Object row : dataVector) {
// if ((Boolean) ((Vector) row).elementAt(1)) {
@@ -67,5 +72,4 @@ class HashDataTableModel extends DefaultTableModel {
// }
// return selection;
// }
-
- }
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/MimeFilter.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/MimeFilter.java
index 6ee61a82..4b48081a 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/MimeFilter.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/MimeFilter.java
@@ -1,7 +1,19 @@
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
+* 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.io.File;
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java
index e8572742..8ae9d7a3 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java
@@ -1,8 +1,19 @@
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
+* 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;
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
index a9c21a00..5f1bc8b2 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
@@ -39,7 +39,7 @@ public class BKUGUITest {
JFrame testFrame = new JFrame("BKUGUITest");
BKUGUI gui = new BKUGUI();
Container contentPane = testFrame.getContentPane();
- contentPane.setPreferredSize(new Dimension(500, 200));
+ contentPane.setPreferredSize(new Dimension(380, 150));
gui.init(contentPane, null);
BKUGUIWorker worker = new BKUGUIWorker();
worker.init(gui);
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index 85f05435..6cbc2cd1 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -82,7 +82,7 @@ public class BKUGUIWorker implements Runnable {
@Override
public InputStream getHashDataInput() {
- return new ByteArrayInputStream("oialfx HashDataInput_001\n12345\n\tHello, world!\n12345\n\n12345\n6789\nblabla".getBytes());
+ return new ByteArrayInputStream("Ich bin ein einfacher Text mit Umlauten: öäüßéç@€\n123\n456\n\tHello, world!\n\nlkjsd\nnksdjf".getBytes());
}
@Override
@@ -94,6 +94,10 @@ public class BKUGUIWorker implements Runnable {
public String getReferenceId() {
return "Reference-ref1-00000000000000000000001";
}
+ @Override
+ public String getEncoding() {
+ return "UTF-8";
+ }
};
HashDataInput signedRef2 = new HashDataInput() {
@@ -111,6 +115,10 @@ public class BKUGUIWorker implements Runnable {
public String getReferenceId() {
return "Reference-ref2-00000000000000000000002";
}
+ @Override
+ public String getEncoding() {
+ return "UTF-8";
+ }
};
HashDataInput signedRef3 = new HashDataInput() {
@@ -128,6 +136,11 @@ public class BKUGUIWorker implements Runnable {
public String getReferenceId() {
return "Reference-ref3-00000000000000000000003";
}
+
+ @Override
+ public String getEncoding() {
+ return "UTF-8";
+ }
};
HashDataInput signedRef4 = new HashDataInput() {
@@ -145,6 +158,11 @@ public class BKUGUIWorker implements Runnable {
public String getReferenceId() {
return "ref4";
}
+
+ @Override
+ public String getEncoding() {
+ return "UTF-8";
+ }
};
//
@@ -153,6 +171,10 @@ public class BKUGUIWorker implements Runnable {
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.showHashDataInputDialog(signedRefs, returnListener, "return");
}
--
cgit v1.2.3
From 12d4f22e52fba1f867571afbd539b532e2afe1b5 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Thu, 18 Sep 2008 09:48:56 +0000
Subject: wait message bug
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@47 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 8 +++---
.../test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 2 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 29 ++++++++++++++--------
3 files changed, 24 insertions(+), 15 deletions(-)
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
index be4aeded..449dfd61 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
@@ -835,7 +835,8 @@ public class BKUGUI implements BKUGUIFacade {
.addComponent(errorMsgLabel)
.addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ mainPanelLayout.createSequentialGroup()
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(errorMsgLabel));
contentPanel.validate();
@@ -859,7 +860,7 @@ public class BKUGUI implements BKUGUIFacade {
if (waitMessage != null) {
waitMsgLabel.setText("" + waitMessage + "");
} else {
- waitMsgLabel.setText("" + messages.getString(MESSAGE_WAIT) + "");
+ waitMsgLabel.setText(messages.getString(MESSAGE_WAIT));
}
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
@@ -873,8 +874,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(waitMsgLabel)
- .addContainerGap());
+ .addComponent(waitMsgLabel));
contentPanel.validate();
}
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
index 5f1bc8b2..2ea0c5a2 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
@@ -34,7 +34,7 @@ import org.junit.Test;
*/
public class BKUGUITest {
- @Ignore
+ @Test
public void testBKUGUI() {
JFrame testFrame = new JFrame("BKUGUITest");
BKUGUI gui = new BKUGUI();
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index 6cbc2cd1..909da4ad 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -43,7 +43,7 @@ public class BKUGUIWorker implements Runnable {
@Override
public void run() {
-// try {
+ try {
final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN");
@@ -185,9 +185,18 @@ public class BKUGUIWorker implements Runnable {
// 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");
@@ -201,7 +210,7 @@ public class BKUGUIWorker implements Runnable {
// Thread.sleep(2000);
//
- gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
+// gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
// Thread.sleep(2000);
@@ -209,18 +218,18 @@ public class BKUGUIWorker implements Runnable {
//
// Thread.sleep(2000);
////
-// gui.showErrorDialog("Testfehler occured", null, null);
-//
-// Thread.sleep(2000);
+ gui.showErrorDialog("Testfehler occured", null, null);
+
+ Thread.sleep(2000);
//
-// gui.showErrorDialog("Testfehler occured");
+ gui.showErrorDialog("Testfehler occured");
// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save");
// Thread.sleep(2000);
-// } catch (InterruptedException ex) {
-// ex.printStackTrace();
-// }
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
}
}
--
cgit v1.2.3
From 49dd625e2537b14b201d254ebef9745d9890a105 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Thu, 18 Sep 2008 09:50:10 +0000
Subject: wait message bug
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@48 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
index 2ea0c5a2..5f1bc8b2 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
@@ -34,7 +34,7 @@ import org.junit.Test;
*/
public class BKUGUITest {
- @Test
+ @Ignore
public void testBKUGUI() {
JFrame testFrame = new JFrame("BKUGUITest");
BKUGUI gui = new BKUGUI();
--
cgit v1.2.3
From 8ccd9ab69dc74762567930f4c576a359502f1071 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Tue, 30 Sep 2008 16:37:59 +0000
Subject: showErrorDialog l10n
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@77 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../at/gv/egiz/bku/online/applet/BKUWorker.java | 10 +++---
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 41 +++++++++++++---------
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 14 ++++++--
.../at/gv/egiz/bku/gui/Messages.properties | 11 +++++-
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 33 +++++++++++------
.../at/gv/egiz/bku/local/stal/BKUGuiProxy.java | 8 ++---
.../gv/egiz/bku/smccstal/SignRequestHandler.java | 7 ++--
7 files changed, 81 insertions(+), 43 deletions(-)
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java
index a87b04c4..12eb9d00 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUWorker.java
@@ -126,7 +126,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
log.fatal("Failed to call STAL service.", e);
actionCommandList.clear();
actionCommandList.add("ok");
- gui.showErrorDialog(errorMessages.getString("failed.WS"));
+ gui.showErrorDialog(BKUGUIFacade.ERR_SERVICE_UNREACHABLE, new Object[] {e.getMessage()});
try {
waitForAction();
} catch (InterruptedException e1) {
@@ -204,7 +204,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
log.info("Done " + Thread.currentThread().getName());
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
- gui.showErrorDialog("Sorry, an internal error occured: " + ex.getMessage());
+ gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {ex.getMessage()});
try {
waitForAction();
} catch (InterruptedException e) {
@@ -279,8 +279,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
case SMCCHelper.PC_SC_NOT_SUPPORTED:
actionCommandList.clear();
actionCommandList.add("ok");
- gui.showErrorDialog(errorMessages.getString("nopcscsupport"), this,
- "ok");
+ gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, this, "ok");
try {
waitForAction();
} catch (InterruptedException e) {
@@ -290,8 +289,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
case SMCCHelper.TERMINAL_NOT_PRESENT:
actionCommandList.clear();
actionCommandList.add("ok");
- gui.showErrorDialog(errorMessages.getString("nocardterminal"), this,
- "ok");
+ gui.showErrorDialog(BKUGUIFacade.ERR_NO_CARDTERMINAL,null,this,"ok");
try {
waitForAction();
} catch (InterruptedException e) {
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
index 749207ee..b09669b8 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
@@ -41,6 +41,8 @@ import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.StringTokenizer;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
@@ -94,7 +96,7 @@ public class BKUGUI implements BKUGUIFacade {
private static final String MESSAGE_OVERWRITE = "message.overwrite";
private static final String LABEL_PIN = "label.pin";
private static final String LABEL_PINSIZE = "label.pinsize";
- private static final String ERROR_NO_HASHDATA = "error.no.hashdata";
+// private static final String ERROR_NO_HASHDATA = "error.no.hashdata";
private static final String BUTTON_OK = "button.ok";
private static final String BUTTON_CANCEL = "button.cancel";
@@ -798,7 +800,7 @@ public class BKUGUI implements BKUGUIFacade {
}
@Override
- public void showErrorDialog(final String errorMsg, final ActionListener okListener, final String okCommand) {
+ public void showErrorDialog(final String errorMsgKey, final Object[] errorMsgParams, final ActionListener okListener, final String okCommand) {
log.debug("scheduling error dialog");
@@ -815,9 +817,12 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_ERROR));
// titleLabel.setForeground(defaultForground);
+ String errorMsgPattern = messages.getString(errorMsgKey);
+ String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams);
+
JLabel errorMsgLabel = new JLabel();
errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- errorMsgLabel.setText("" + errorMsg + "");
+ errorMsgLabel.setText(errorMsg);
errorMsgLabel.setForeground(ERROR_COLOR);
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
@@ -860,7 +865,7 @@ public class BKUGUI implements BKUGUIFacade {
}
@Override
- public void showErrorDialog(final String errorMsg) {
+ public void showErrorDialog(final String errorMsgKey, final Object[] errorMsgParams) {
log.debug("scheduling error dialog");
@@ -877,10 +882,13 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_ERROR));
// titleLabel.setForeground(defaultForground);
- JLabel errorMsgLabel = new JLabel();
- errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- errorMsgLabel.setText("" + errorMsg + "");
- errorMsgLabel.setForeground(ERROR_COLOR);
+ String errorMsgPattern = messages.getString(errorMsgKey);
+ String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams);
+
+ JLabel errorMsgLabel = new JLabel();
+ errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ errorMsgLabel.setText(errorMsg);
+ errorMsgLabel.setForeground(ERROR_COLOR);
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
@@ -955,7 +963,7 @@ public class BKUGUI implements BKUGUIFacade {
public void showHashDataInputDialog(final List signedReferences, final ActionListener okListener, final String okCommand) {
if (signedReferences == null) {
- showErrorDialog(messages.getString(ERROR_NO_HASHDATA), okListener, okCommand);
+ showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {"No SignedReferences provided"}, okListener, okCommand);
}
if (signedReferences.size() == 1) {
@@ -971,11 +979,12 @@ public class BKUGUI implements BKUGUIFacade {
showSaveHashDataInputDialog(signedReferences, okListener, okCommand);
}
};
- String hashDataText = getText(signedReferences.get(0));
- if (hashDataText != null) {
+
+ try {
+ String hashDataText = getText(signedReferences.get(0));
showPlainTextHashDataInputDialog(hashDataText, saveHashDataListener, "save", okListener, okCommand);
- } else {
- showErrorDialog(messages.getString(ERROR_NO_HASHDATA), okListener, okCommand);
+ } catch (IOException ex) {
+ showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {ex.getMessage()}, okListener, okCommand);
}
} else {
@@ -1300,7 +1309,7 @@ public class BKUGUI implements BKUGUIFacade {
bos.close();
} catch (IOException ex) {
log.error("Failed to write HashDataInput to file " + file + ": " + ex.getMessage());
- showErrorDialog("Failed to write signed reference to file: " + ex.getMessage(), null, null);
+ showErrorDialog(ERR_WRITE_HASHDATA, new Object[] {ex.getMessage()}, null, null);
ex.printStackTrace();
} finally {
try {
@@ -1316,7 +1325,7 @@ public class BKUGUI implements BKUGUIFacade {
});
}
- private static String getText(HashDataInput hdi) {
+ private static String getText(HashDataInput hdi) throws IOException {
ByteArrayOutputStream baos = null;
try {
InputStream hashDataIS = hdi.getHashDataInput();
@@ -1338,7 +1347,7 @@ public class BKUGUI implements BKUGUIFacade {
}
} catch (IOException ex) {
log.error("Failed to read HashDataInput for reference " + hdi.getReferenceId() + ": " + ex.getMessage());
- return null;
+ throw ex;
} finally {
try {
baos.close();
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index f4b6325d..32eb4c3e 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -23,7 +23,15 @@ import java.awt.event.ActionListener;
import java.util.List;
public interface BKUGUIFacade {
-
+
+ public static final String ERR_UNKNOWN = "error.unknown";
+ public static final String ERR_SERVICE_UNREACHABLE = "error.ws.unreachable";
+ public static final String ERR_NO_PCSC = "error.pcsc";
+ public static final String ERR_NO_CARDTERMINAL = "error.cardterminal";
+ public static final String ERR_NO_HASHDATA = "error.no.hashdata";
+ public static final String ERR_WRITE_HASHDATA = "error.write.hashdata";
+ public static final String ERR_INVALID_HASH = "error.invalid.hash";
+
public void init(Container contentPane, String localeString);
public void showWelcomeDialog();
@@ -55,7 +63,7 @@ public interface BKUGUIFacade {
// public void showPlainTextHashDataInputDialog(String text, ActionListener saveListener, String saveCommand, ActionListener cancelListener, String cancelCommand);
- public void showErrorDialog(String errorMsg, ActionListener okListener, String actionCommand);
+ public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams, ActionListener okListener, String actionCommand);
- public void showErrorDialog(String errorMsg);
+ public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams);
}
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index a329ba86..79e23859 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -35,7 +35,6 @@ message.retries=Noch {0} Versuche
message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?
label.pin={0}:
label.pinsize=({0} stellig)
-error.no.hashdata=Keine Signaturdaten verf\u00FCgbar
button.ok=OK
button.cancel=Abbrechen
button.back=Zur\u00FCck
@@ -48,3 +47,13 @@ mimetype.desc.txt=Textdateien (.txt)
mimetype.desc.pdf=Adobe PDF-Dateien (.pdf)
mimetype.desc.bin=Bin\u00E4rdateien (.bin)
save.hashdatainput.prefix=Signaturdaten
+
+# Error Messages
+error.no.hashdata=Keine Signaturdaten verf\u00FCgbar: {0}
+error.write.hashdata=Die Signaturdaten konnten nicht gespeichert werden: {0}
+error.invalid.hash=Die Signaturdaten sind ung\u00FCltig: {0}
+error.ws.unreachable=Das Web-Service ist nicht erreichbar: {0}
+error.pcsc=Java(TM) scheint keine PC/SC Schnittstelle f\u00FCr den Smartcard-Zugriff zur Verf\u00FCgung zu stellen.
+error.cardterminal=Es konnte kein Smartcard-Leser gefunden werden.Entweder ist kein Leser angeschlossen oder kein PC/SC Treiber installiert.
+error.unknown=Leider trat ein Fehler auf: {0}
+error.test=Fehler1 {0} - Fehler2 {1}
\ No newline at end of file
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index 909da4ad..0641bf58 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -186,13 +186,13 @@ public class BKUGUIWorker implements Runnable {
//
// Thread.sleep(2000);
- gui.showWaitDialog(null);
-
- Thread.sleep(1000);
-
- gui.showWaitDialog("test");
-
- Thread.sleep(1000);
+// gui.showWaitDialog(null);
+//
+// Thread.sleep(1000);
+//
+// gui.showWaitDialog("test");
+//
+// Thread.sleep(1000);
// gui.showInsertCardDialog(cancelListener, "cancel");
@@ -218,11 +218,24 @@ public class BKUGUIWorker implements Runnable {
//
// Thread.sleep(2000);
////
- gui.showErrorDialog("Testfehler occured", null, null);
-
+// 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("Testfehler occured");
+ 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.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save");
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
index c543c8ca..22ab1d6f 100644
--- 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
@@ -65,16 +65,16 @@ public class BKUGuiProxy implements BKUGUIFacade {
}
@Override
- public void showErrorDialog(String errorMsg, ActionListener okListener,
+ public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams, ActionListener okListener,
String actionCommand) {
showDialog();
- delegate.showErrorDialog(errorMsg, okListener, actionCommand);
+ delegate.showErrorDialog(errorMsgKey, errorMsgParams, okListener, actionCommand);
}
@Override
- public void showErrorDialog(String errorMsg) {
+ public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams) {
showDialog();
- delegate.showErrorDialog(errorMsg);
+ delegate.showErrorDialog(errorMsgKey, errorMsgParams);
}
@Override
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
index 0b297283..7d994392 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
@@ -16,6 +16,7 @@
*/
package at.gv.egiz.bku.smccstal;
+import at.gv.egiz.bku.gui.BKUGUIFacade;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.security.MessageDigest;
@@ -318,15 +319,15 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen
gui.showHashDataInputDialog(hashDataInputs, SignRequestHandler.this, "ok");
} catch (DigestException ex) {
log.error("Bad digest value: " + ex.getMessage());
- gui.showErrorDialog(ex.getMessage());
+ gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH, new Object[] {ex.getMessage()});
} catch (Exception ex) {
//FIXME localize messages
log.error("Failed to obtain HashDataInputs: " + ex.getMessage());
- gui.showErrorDialog("Failed to obtain HashDataInputs: " + ex.getMessage(), SignRequestHandler.this, "ok");
+ gui.showErrorDialog(BKUGUIFacade.ERR_NO_HASHDATA, new Object[] {ex.getMessage()}, SignRequestHandler.this, "ok");
}
} else {
//FIXME get all hashdatainputs
- gui.showErrorDialog("Failed to obtain HashDataInputs: No dsig:SignedInfo provided.", SignRequestHandler.this, "ok");
+ gui.showErrorDialog(BKUGUIFacade.ERR_NO_HASHDATA, new Object[] {"No dsig:SignedInfo provided"}, SignRequestHandler.this, "ok");
}
} else if (actionCommand.equals("sign")) {
return new String(gui.getPin());
--
cgit v1.2.3
From d7a3b8fdb62c881afb87838f2bb03b4c4b58e16d Mon Sep 17 00:00:00 2001
From: clemenso
Date: Wed, 8 Oct 2008 15:59:43 +0000
Subject: simpleGUI (header,chipperling removed)
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@87 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
BKUApplet/pom.xml | 30 +-
BKUApplet/src/test/resources/appletTest.html | 29 ++
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 295 ++++++-----
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 77 ++-
BKULocalApp/pom.xml | 2 +-
BKUOnline/src/main/webapp/appletPage.jsp | 16 +-
.../finanzonline/FinanzOnlineLogin/award.gif | Bin 0 -> 8717 bytes
.../finanzonline/FinanzOnlineLogin/bmf_01.gif | Bin 0 -> 2479 bytes
.../finanzonline/FinanzOnlineLogin/bmf_02.gif | Bin 0 -> 5583 bytes
.../finanzonline/FinanzOnlineLogin/browser.js | 165 ++++++
.../FinanzOnlineLogin/buergerkarte.gif | Bin 0 -> 1219 bytes
.../finanzonline/FinanzOnlineLogin/eps-logo.gif | Bin 0 -> 4557 bytes
.../finanzonline/FinanzOnlineLogin/epsa-award.jpg | Bin 0 -> 24106 bytes
.../webapp/finanzonline/FinanzOnlineLogin/fon.css | 553 +++++++++++++++++++++
.../finanzonline/FinanzOnlineLogin/index.css | 101 ++++
BKUOnline/src/main/webapp/finanzonline/iframe.html | 22 +
BKUOnline/src/main/webapp/finanzonline/index.html | 192 +++++++
BKUOnline/src/main/webapp/index.html | 2 +
BKUOnline/src/test/resources/appletTest.html | 2 +-
19 files changed, 1279 insertions(+), 207 deletions(-)
create mode 100644 BKUApplet/src/test/resources/appletTest.html
create mode 100644 BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/award.gif
create mode 100644 BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/bmf_01.gif
create mode 100644 BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/bmf_02.gif
create mode 100644 BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/browser.js
create mode 100644 BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/buergerkarte.gif
create mode 100644 BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/eps-logo.gif
create mode 100644 BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/epsa-award.jpg
create mode 100644 BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/fon.css
create mode 100644 BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/index.css
create mode 100644 BKUOnline/src/main/webapp/finanzonline/iframe.html
create mode 100644 BKUOnline/src/main/webapp/finanzonline/index.html
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml
index 35672e51..130749c5 100644
--- a/BKUApplet/pom.xml
+++ b/BKUApplet/pom.xml
@@ -1,6 +1,5 @@
-
+
bku
at.gv.egiz
@@ -11,7 +10,6 @@
BKUApplet
BKU Applet
1.0-SNAPSHOT
-
@@ -81,6 +79,30 @@
true
+
+ maven-dependency-plugin
+
+
+ copytestlibs
+
+ copy
+
+
+
+
+ commons-logging
+ commons-logging
+
+
+ iaik
+ iaik_jce_me4se
+
+
+ ${project.build.directory}/test-libs
+
+
+
+
@@ -114,4 +136,4 @@
commons-logging
-
\ No newline at end of file
+
diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html
new file mode 100644
index 00000000..3b944a40
--- /dev/null
+++ b/BKUApplet/src/test/resources/appletTest.html
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
index b09669b8..24cc2601 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
@@ -40,11 +40,7 @@ import java.text.MessageFormat;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
-import java.util.StringTokenizer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import javax.swing.GroupLayout;
-import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
@@ -56,7 +52,6 @@ import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.LayoutStyle;
-import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
@@ -107,14 +102,14 @@ public class BKUGUI implements BKUGUIFacade {
protected Container contentPane;
protected ResourceBundle messages;
/** left and right side main panels */
- protected JPanel iconPanel;
+// protected JPanel iconPanel;
protected JPanel contentPanel;
/** right side content panels and layouts */
- protected JPanel headerPanel;
+// protected JPanel headerPanel;
protected JPanel mainPanel;
protected JPanel buttonPanel;
/** right side fixed labels */
- protected JLabel titleLabel;
+// protected JLabel titleLabel;
/** remember the pinfield to return to worker */
protected JPasswordField pinField;
@@ -153,13 +148,21 @@ public class BKUGUI implements BKUGUIFacade {
log.debug("initializing gui");
- initIconPanel();
+// initIconPanel();
initContentPanel();
GroupLayout layout = new GroupLayout(contentPane);
contentPane.setLayout(layout);
- layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(iconPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
- layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(iconPanel, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
+ layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(contentPanel));
+ layout.setVerticalGroup(layout.createSequentialGroup().addComponent(contentPanel));
+// layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addGroup(layout.createSequentialGroup()
+// .addComponent(iconPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+// .addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
+// layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addComponent(iconPanel, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+// .addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
}
});
} catch (Exception ex) {
@@ -167,34 +170,30 @@ public class BKUGUI implements BKUGUIFacade {
}
}
- protected void initIconPanel() {
- iconPanel = new JPanel();
- JLabel iconLabel = new JLabel();
- iconLabel.setIcon(new ImageIcon(getClass().getResource(LOGO_RESOURCE))); // NOI18N
-
- GroupLayout iconPanelLayout = new GroupLayout(iconPanel);
- iconPanel.setLayout(iconPanelLayout);
- iconPanelLayout.setHorizontalGroup(
- iconPanelLayout.createSequentialGroup()
-// iconPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
-// .addGroup(iconPanelLayout.createSequentialGroup()
- .addContainerGap()
- .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, iconLabel.getPreferredSize().width, GroupLayout.PREFERRED_SIZE)
- .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //);
- iconPanelLayout.setVerticalGroup(
- iconPanelLayout.createSequentialGroup()
-// iconPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
-// .addGroup(iconPanelLayout.createSequentialGroup()
- .addContainerGap()
- .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, iconLabel.getPreferredSize().height, GroupLayout.PREFERRED_SIZE)
- .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //);
- }
+// protected void initIconPanel() {
+// iconPanel = new JPanel();
+// JLabel iconLabel = new JLabel();
+// iconLabel.setIcon(new ImageIcon(getClass().getResource(LOGO_RESOURCE))); // NOI18N
+//
+// GroupLayout iconPanelLayout = new GroupLayout(iconPanel);
+// iconPanel.setLayout(iconPanelLayout);
+// iconPanelLayout.setHorizontalGroup(
+// iconPanelLayout.createSequentialGroup()
+// .addContainerGap()
+// .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, iconLabel.getPreferredSize().width, GroupLayout.PREFERRED_SIZE)
+// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //);
+// iconPanelLayout.setVerticalGroup(
+// iconPanelLayout.createSequentialGroup()
+// .addContainerGap()
+// .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, iconLabel.getPreferredSize().height, GroupLayout.PREFERRED_SIZE)
+// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //);
+// }
protected void initContentPanel() {
contentPanel = new JPanel();
- headerPanel = new JPanel();
+// headerPanel = new JPanel();
mainPanel = new JPanel();
buttonPanel = new JPanel();
@@ -202,22 +201,9 @@ public class BKUGUI implements BKUGUIFacade {
// mainPanel.setBorder(new TitledBorder("main"));
// buttonPanel.setBorder(new TitledBorder("button"));
- titleLabel = new JLabel();
- titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() |
- java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2));
-// titleLabel.setForeground(defaultForground);
-
-// okButton = new JButton();
-// okButton.setText(messages.getString(BUTTON_OK));
-// cancelButton = new JButton();
-// cancelButton.setText(messages.getString(BUTTON_CANCEL));
-// signButton = new JButton();
-// signButton.setText(messages.getString(BUTTON_SIGN));
-// backButton = new JButton();
-// backButton.setText(messages.getString(BUTTON_BACK));
-// saveButton = new JButton();
-// saveButton.setText(messages.getString(BUTTON_SAVE));
-// contentPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
+// titleLabel = new JLabel();
+// titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() |
+// java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2));
JButton b = new JButton();
b.setText(messages.getString(BUTTON_CANCEL));
@@ -246,33 +232,38 @@ public class BKUGUI implements BKUGUIFacade {
// buttonSize = saveButton.getPreferredSize().width;
- GroupLayout headerPanelLayout = new GroupLayout(headerPanel);
- headerPanel.setLayout(headerPanelLayout);
-
- headerPanelLayout.setHorizontalGroup(
- headerPanelLayout.createSequentialGroup()
-// headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
- .addContainerGap());
- headerPanelLayout.setVerticalGroup(
- headerPanelLayout.createSequentialGroup()
-// headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+// GroupLayout headerPanelLayout = new GroupLayout(headerPanel);
+// headerPanel.setLayout(headerPanelLayout);
+//
+// headerPanelLayout.setHorizontalGroup(
+// headerPanelLayout.createSequentialGroup()
+// .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
+// .addContainerGap());
+// headerPanelLayout.setVerticalGroup(
+// headerPanelLayout.createSequentialGroup()
+// .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
-// mainPanel.setPreferredSize(new Dimension(MAIN_PANEL_WIDTH, MAIN_PANEL_HEIGHT));
GroupLayout contentPanelLayout = new GroupLayout(contentPanel);
contentPanel.setLayout(contentPanelLayout);
+// contentPanelLayout.setHorizontalGroup(
+// contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+// .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+// .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //));
contentPanelLayout.setHorizontalGroup(
- contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //));
+ contentPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(
+ contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addContainerGap());
contentPanelLayout.setVerticalGroup(
contentPanelLayout.createSequentialGroup()
.addContainerGap()
- .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+// .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) //, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
@@ -294,8 +285,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
- titleLabel.setText(messages.getString(TITLE_ERROR));
-// titleLabel.setForeground(defaultForground);
+// titleLabel.setText(messages.getString(TITLE_ERROR));
JLabel waitMsgLabel = new JLabel();
waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
@@ -308,8 +298,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(waitMsgLabel)
- .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+ .addComponent(waitMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(waitMsgLabel));
@@ -334,12 +323,11 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
- titleLabel.setText(messages.getString(TITLE_WELCOME));
-// titleLabel.setForeground(defaultForground);
+// titleLabel.setText(messages.getString(TITLE_WELCOME));
- JLabel waitMsgLabel = new JLabel();
- waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- waitMsgLabel.setText(messages.getString(MESSAGE_WAIT));
+ JLabel welcomeMsgLabel = new JLabel();
+ welcomeMsgLabel.setFont(welcomeMsgLabel.getFont().deriveFont(welcomeMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ welcomeMsgLabel.setText(messages.getString(TITLE_WELCOME)); //MESSAGE_WAIT));
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
@@ -347,12 +335,11 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(waitMsgLabel)
- .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+ .addComponent(welcomeMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(waitMsgLabel));
+ .addComponent(welcomeMsgLabel));
contentPanel.validate();
@@ -375,8 +362,24 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
- titleLabel.setText(messages.getString(TITLE_INSERTCARD));
+// titleLabel.setText(messages.getString(TITLE_INSERTCARD));
+ JLabel insertCardMsgLabel = new JLabel();
+ insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ insertCardMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD));
+
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
+
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createSequentialGroup()
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(insertCardMsgLabel));
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createSequentialGroup()
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(insertCardMsgLabel));
+
JButton cancelButton = new JButton();
cancelButton.setText(messages.getString(BUTTON_CANCEL));
cancelButton.addActionListener(cancelListener);
@@ -391,8 +394,7 @@ public class BKUGUI implements BKUGUIFacade {
// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
- .addContainerGap()); //);
+ .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
buttonPanelLayout.setVerticalGroup(
buttonPanelLayout.createSequentialGroup()
// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
@@ -403,6 +405,11 @@ public class BKUGUI implements BKUGUIFacade {
});
}
+ /**
+ * only difference to showInsertCard: title text: card not supported
+ * @param cancelListener
+ * @param cancelCommand
+ */
@Override
public void showCardNotSupportedDialog(final ActionListener cancelListener, final String cancelCommand) {
@@ -418,12 +425,11 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
- titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED));
-// titleLabel.setForeground(defaultForground);
+// titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED));
- JLabel errorMsgLabel = new JLabel();
- errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- errorMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD));
+ JLabel insertCardMsgLabel = new JLabel();
+ insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ insertCardMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD));
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
@@ -431,12 +437,11 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(errorMsgLabel)
- .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+ .addComponent(insertCardMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(errorMsgLabel));
+ .addComponent(insertCardMsgLabel));
JButton cancelButton = new JButton();
cancelButton.setText(messages.getString(BUTTON_CANCEL));
@@ -452,8 +457,7 @@ public class BKUGUI implements BKUGUIFacade {
// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
- .addContainerGap()); //);
+ .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
buttonPanelLayout.setVerticalGroup(
buttonPanelLayout.createSequentialGroup()
// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
@@ -478,12 +482,12 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
- if (numRetries < 0) {
- String cardpinTitle = messages.getString(TITLE_CARDPIN);
- titleLabel.setText(MessageFormat.format(cardpinTitle, new Object[]{pinSpec.getLocalizedName()}));
- } else {
- titleLabel.setText(messages.getString(TITLE_RETRY));
- }
+// if (numRetries < 0) {
+// String cardpinTitle = messages.getString(TITLE_CARDPIN);
+// titleLabel.setText(MessageFormat.format(cardpinTitle, new Object[]{pinSpec.getLocalizedName()}));
+// } else {
+// titleLabel.setText(messages.getString(TITLE_RETRY));
+// }
JButton cancelButton = new JButton();
cancelButton.setText(messages.getString(BUTTON_CANCEL));
@@ -572,8 +576,7 @@ public class BKUGUI implements BKUGUIFacade {
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //))
- .addComponent(infoLabel))
- .addContainerGap());
+ .addComponent(infoLabel)));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
@@ -595,8 +598,7 @@ public class BKUGUI implements BKUGUIFacade {
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
- .addContainerGap());//);
+ .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
buttonPanelLayout.setVerticalGroup(
buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(okButton)
@@ -643,11 +645,11 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
- if (numRetries < 0) {
- titleLabel.setText(messages.getString(TITLE_SIGN));
- } else {
- titleLabel.setText(messages.getString(TITLE_RETRY));
- }
+// if (numRetries < 0) {
+// titleLabel.setText(messages.getString(TITLE_SIGN));
+// } else {
+// titleLabel.setText(messages.getString(TITLE_RETRY));
+// }
JButton cancelButton = new JButton();
cancelButton.setText(messages.getString(BUTTON_CANCEL));
@@ -712,16 +714,14 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(hashDataLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
- .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
- .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(infoLabel))))
- .addContainerGap());
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(hashDataLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
+ .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(infoLabel))));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
@@ -743,8 +743,7 @@ public class BKUGUI implements BKUGUIFacade {
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(signButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
- .addContainerGap());//);
+ .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
buttonPanelLayout.setVerticalGroup(
buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(signButton)
@@ -814,8 +813,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
- titleLabel.setText(messages.getString(TITLE_ERROR));
-// titleLabel.setForeground(defaultForground);
+// titleLabel.setText(messages.getString(TITLE_ERROR));
String errorMsgPattern = messages.getString(errorMsgKey);
String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams);
@@ -831,8 +829,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(errorMsgLabel) //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
- .addContainerGap());
+ .addComponent(errorMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
@@ -852,8 +849,7 @@ public class BKUGUI implements BKUGUIFacade {
// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
// .addGroup(GroupLayout.Alignment.TRAILING, buttonPanelLayout.createSequentialGroup()
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
- .addContainerGap()); //);
+ .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
buttonPanelLayout.setVerticalGroup(
buttonPanelLayout.createSequentialGroup()
// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
@@ -879,16 +875,15 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
- titleLabel.setText(messages.getString(TITLE_ERROR));
-// titleLabel.setForeground(defaultForground);
+// titleLabel.setText(messages.getString(TITLE_ERROR));
String errorMsgPattern = messages.getString(errorMsgKey);
- String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams);
-
- JLabel errorMsgLabel = new JLabel();
- errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- errorMsgLabel.setText(errorMsg);
- errorMsgLabel.setForeground(ERROR_COLOR);
+ String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams);
+
+ JLabel errorMsgLabel = new JLabel();
+ errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ errorMsgLabel.setText(errorMsg);
+ errorMsgLabel.setForeground(ERROR_COLOR);
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
@@ -896,8 +891,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(errorMsgLabel)
- .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+ .addComponent(errorMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
@@ -923,7 +917,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
- titleLabel.setText(messages.getString(TITLE_WAIT));
+// titleLabel.setText(messages.getString(TITLE_WAIT));
JLabel waitMsgLabel = new JLabel();
waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
@@ -939,8 +933,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(waitMsgLabel)
- .addContainerGap()); //, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
+ .addComponent(waitMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
@@ -1020,7 +1013,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
- titleLabel.setText(messages.getString(TITLE_HASHDATA));
+// titleLabel.setText(messages.getString(TITLE_HASHDATA));
JLabel refIdLabel = new JLabel();
refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
@@ -1042,11 +1035,9 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(refIdLabel)
- .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE))
- .addContainerGap());
+ .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
@@ -1082,8 +1073,7 @@ public class BKUGUI implements BKUGUIFacade {
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
- .addContainerGap());
+ .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
buttonPanelLayout.setVerticalGroup(
buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(saveButton)
@@ -1117,7 +1107,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
- titleLabel.setText(messages.getString(TITLE_HASHDATA));
+// titleLabel.setText(messages.getString(TITLE_HASHDATA));
JLabel refIdLabel = new JLabel();
refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
@@ -1142,11 +1132,9 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(refIdLabel)
- .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE)) // GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addContainerGap());
+ .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
@@ -1228,8 +1216,7 @@ public class BKUGUI implements BKUGUIFacade {
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
- .addContainerGap());//);
+ .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
buttonPanelLayout.setVerticalGroup(
buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(saveButton)
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index 0641bf58..c366cb76 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -168,9 +168,9 @@ public class BKUGUIWorker implements Runnable {
//
List signedRefs = new ArrayList();
signedRefs.add(signedRef1);
- signedRefs.add(signedRef2);
- signedRefs.add(signedRef3);
- signedRefs.add(signedRef4);
+// signedRefs.add(signedRef2);
+// signedRefs.add(signedRef3);
+// signedRefs.add(signedRef4);
// signedRefs.add(signedRef4);
// signedRefs.add(signedRef4);
// signedRefs.add(signedRef4);
@@ -182,62 +182,61 @@ public class BKUGUIWorker implements Runnable {
-// gui.showWelcomeDialog();
-//
-// Thread.sleep(2000);
+ gui.showWelcomeDialog();
+
+ Thread.sleep(2000);
+
+ gui.showWaitDialog(null);
+
+ Thread.sleep(1000);
-// gui.showWaitDialog(null);
-//
-// Thread.sleep(1000);
-//
-// gui.showWaitDialog("test");
-//
-// Thread.sleep(1000);
+ gui.showWaitDialog("test");
+
+ Thread.sleep(1000);
-// gui.showInsertCardDialog(cancelListener, "cancel");
-//
-// Thread.sleep(2000);
-//
-// gui.showCardNotSupportedDialog(cancelListener, "cancel");
-//
-// Thread.sleep(2000);
+ gui.showInsertCardDialog(cancelListener, "cancel");
-// PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN");
-////
-// gui.showCardPINDialog(cardPinSpec, okListener, "ok", cancelListener, "cancel");
-//
-// Thread.sleep(2000);
-//
+ 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");
+ gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
-// Thread.sleep(2000);
+ Thread.sleep(4000);
-// 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.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.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save");
// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save");
// Thread.sleep(2000);
diff --git a/BKULocalApp/pom.xml b/BKULocalApp/pom.xml
index 9ad6f50b..594f5af2 100644
--- a/BKULocalApp/pom.xml
+++ b/BKULocalApp/pom.xml
@@ -8,7 +8,7 @@
4.0.0
at.gv.egiz.bku
BKULocalApp
-
+ BKU Local App
1.0-SNAPSHOT
diff --git a/BKUOnline/src/main/webapp/appletPage.jsp b/BKUOnline/src/main/webapp/appletPage.jsp
index 5f208a2a..b9225e56 100644
--- a/BKUOnline/src/main/webapp/appletPage.jsp
+++ b/BKUOnline/src/main/webapp/appletPage.jsp
@@ -19,12 +19,12 @@
-
-MOCCA Appletpage
-
+
+ MOCCA Appletpage
+
+
-
-
+
diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/award.gif b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/award.gif
new file mode 100644
index 00000000..8807fcf6
Binary files /dev/null and b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/award.gif differ
diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/bmf_01.gif b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/bmf_01.gif
new file mode 100644
index 00000000..dd7697a4
Binary files /dev/null and b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/bmf_01.gif differ
diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/bmf_02.gif b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/bmf_02.gif
new file mode 100644
index 00000000..961d511e
Binary files /dev/null and b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/bmf_02.gif differ
diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/browser.js b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/browser.js
new file mode 100644
index 00000000..6fbf74f0
--- /dev/null
+++ b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/browser.js
@@ -0,0 +1,165 @@
+var BrowserDetect = {
+ init: function () {
+ this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
+ this.version = this.searchVersion(navigator.userAgent)
+ || this.searchVersion(navigator.appVersion)
+ || "an unknown version";
+ this.OS = this.searchString(this.dataOS) || "an unknown OS";
+ },
+ searchString: function (data) {
+ for (var i=0;i");
+ document.write("Sehr geehrter FinanzOnline-Teilnehmer!Die Menüführung in FinanzOnline wurde aus technischen Gründen geändert. Da Sie möglicherweise eine veraltete und nicht mehr dem letzten Sicherheitsstandard entsprechende Version Ihres Webbrowsers verwenden, besteht ab diesem Zeitpunkt die Möglichkeit, dass das Menü in FinanzOnline nicht richtig angezeigt werden kann.
Wir empfehlen daher bereits heute auch zu Ihrer Sicherheit, ein Update auf die aktuell gültige Browserversion durchzuführen. Die unterstützten Webbrowser finden Sie auf der BMF-Homepage unter 'E-Government'/'FinanzOnline'/'Browsereinstellungen' .
");
+
+
+/* document.write("Verwendeter Browser: " + BrowserDetect.browser + " " + BrowserDetect.version + " / " + BrowserDetect.OS);
+ if(BrowserDetect.browser.toLowerCase() == "explorer") {
+ if(eval(BrowserDetect.version) < 6) {
+ document.write(" *** nicht supported *** ");
+ } else {
+ //document.write(" *** supported *** ");
+ }
+ }
+ if(BrowserDetect.browser.toLowerCase() == "opera") {
+ if(eval(BrowserDetect.version) < 9) {
+ document.write(" *** nicht supported *** ");
+ } else {
+ //document.write(" *** supported *** ");
+ }
+ }
+ if(BrowserDetect.browser.toLowerCase() == "firefox") {
+ if(eval(BrowserDetect.version) < 1.5) {
+ document.write(" *** nicht supported *** ");
+ } else {
+ //document.write(" *** supported *** ");
+ }
+ }
+// document.write(" Vorschlag für unterstütze Browser: ");
+// document.write("Internet Explorer 6, PC ");
+// document.write("Internet Explorer 7, PC ");
+// document.write("Firefox (>= 1.5), PC + Mac + Linux ");
+// document.write("Safari (>= 1.3+), Mac (<- WIE TESTEN??) ");
+// document.write("Opera (>= 9), PC + Mac + Linux ");
+// document.write(" ");
+*/
+ document.write("
");
+
+ }
+}
\ No newline at end of file
diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/buergerkarte.gif b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/buergerkarte.gif
new file mode 100644
index 00000000..99d5f37e
Binary files /dev/null and b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/buergerkarte.gif differ
diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/eps-logo.gif b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/eps-logo.gif
new file mode 100644
index 00000000..6f4ee65c
Binary files /dev/null and b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/eps-logo.gif differ
diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/epsa-award.jpg b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/epsa-award.jpg
new file mode 100644
index 00000000..0e68626d
Binary files /dev/null and b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/epsa-award.jpg differ
diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/fon.css b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/fon.css
new file mode 100644
index 00000000..f9b7b229
--- /dev/null
+++ b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/fon.css
@@ -0,0 +1,553 @@
+BODY {
+ margin-left : 0px;
+ margin-right : 0px;
+ margin-top : 0px;
+ color : black;
+ background-color : #E8F4FE;
+ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif, sans-serif;
+ font-size:13px;
+ font-weight: normal;
+}
+table.user {
+ background-color: #D6E6F9;
+ width: 100%;
+ font-family:Verdana,Arial,Helv;
+ font-size:13px;
+}
+
+.BUT {
+ HEIGHT: 20px;
+ BORDER:1px solid #000000;
+ TEXT-DECORATION:none;
+ BACKGROUND-IMAGE:url(../graphics/butback.gif);
+}
+
+A {
+ color : #000000;
+}
+
+
+TH.label {
+ padding: 10px;
+ margin-left: 10px;
+ font-size: 13px;
+ font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-weight: bold;
+ color: #D6E6F9;
+ background-color: #006699;
+ vertical-align: top
+}
+
+TH.label_hell {
+ padding : 5px;
+ margin-left : 10px;
+ font-size : 13px;
+ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-weight : bold;
+ color : #000000;
+ background-color : #D6E6F9;
+ vertical-align : top;
+ text-align : left;
+}
+TD.input {
+ padding : 5px;
+ margin-left : 10px;
+ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+ color : #000000;
+ background-color : #D6E6F9;
+ vertical-align : middle;
+ text-align : right;
+ font-size: 13px;
+}
+
+TD.input_links {
+ padding: 5px;
+ margin-left: 10px;
+ font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
+ color: #000000;
+ background-color: #D6E6F9;
+ vertical-align: bottom;
+ text-align: left;
+ font-size: 13px;
+}
+
+TD.input_center {
+ padding: 5px;
+ margin-left: 10px;
+ font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
+ color: #000000;
+ background-color: #D6E6F9;
+ vertical-align: bottom;
+ text-align: center;
+ font-size: 13px;
+}
+
+TD.input_mitte {
+ padding : 5px;
+ margin-left : 10px;
+ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+ color : #000000;
+ background-color : #D6E6F9;
+ vertical-align : middle;
+ text-align : left;
+ font-size: 13px;
+}
+
+TD.spacer {
+ padding : 5px;
+ margin-left : 10px;
+ background-color : #D6E6F9;
+ vertical-align : top;
+ font-size: 50%;
+}
+TD.erlaeut2 {
+ padding : 5px;
+ margin-left : 5px;
+ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+ color : #000000;
+ background-color : #D6E6F9;
+ vertical-align : top;
+ font-size: 13px;
+}
+TD.erlaeut {
+ padding : 5px;
+ margin-left : 10px;
+ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+ color : #000000;
+ background-color : #D6E6F9;
+ vertical-align : top;
+ font-size: 13px;
+}
+TD.erlaeut_white {
+ margin-left : 10px;
+ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+ color : #000000;
+ background-color : #D6E5F8;
+ vertical-align : top;
+ font-size: 13px;
+}
+TD.login {
+ padding : 5px;
+ margin-left : 10px;
+ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+ color : #000000;
+ vertical-align : top;
+ font-size: 13px;
+}
+.tabcap {
+ margin-left : 10px;
+ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-weight : bold;
+ color : #D6E6F9;
+ background-color : #6699CC;
+ font-size : 13px;
+ font-weight : bold;
+ padding : 5px;
+ padding-top:1px;
+ padding-bottom:1px;
+}
+
+INPUT {
+ font-family : Verdana,Arial,Helv;
+ font-size : 8pt;
+ color : #000000;
+}
+
+TD.erlaeut_fett {
+ padding : 5px;
+ margin-left : 10px;
+ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+ color : #000000;
+ background-color : #D6E6F9;
+ vertical-align : top;
+ font-size : 13px;
+ font-weight : bold;
+}
+
+
+TABLE.normal {
+ width : 100%;
+}
+CAPTION.cap {
+ width : 100%;
+ padding : 10px;
+ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+ color : black;
+ background-color : #E8FDFD;
+ font-size : 11pt;
+ font-weight : bold;
+}
+
+H1{
+ color : #D6E6F9;
+ text-align : center;
+ border-left-color: #996666;
+ padding-top: 0px;
+ padding-right: 0px;
+ padding-bottom: 0px;
+ padding-left: 10px;
+ ;
+ border-style: solid;
+ border-top-width: 0px;
+ border-right-width: 0px;
+ border-bottom-width: 0px;
+ border-left-width : 0px;
+ background-color : #006699;
+}
+H2{
+ color : #006699;
+ text-align : center;
+ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+ padding-top: 0px;
+ padding-right: 0px;
+ padding-bottom: 0px;
+ padding-left: 10px;
+ font-size : 25px;
+}
+H3{
+ color : #006699;;
+ text-align : center;
+ border-left-color: #996666;
+ padding-top: 0px;
+ padding-right: 0px;
+ padding-bottom: 0px;
+ padding-left: 10px;
+ border-style: solid;
+ border-top-width: 0px;
+ border-right-width: 0px;
+ border-bottom-width: 0px;
+ border-left-width : 0px;
+}
+H3.info_center{
+ color : #006699;
+ text-align : center;
+ padding-top: 0px;
+ padding-right: 0px;
+ padding-bottom: 0px;
+ padding-left: 10px;
+ border-style: solid;
+ border-top-width: 0px;
+ border-right-width: 0px;
+ border-bottom-width: 0px;
+ border-left-width : 0px;
+}
+.inv{
+ color : #D6E6F9;
+ text-align : left;
+ background-color : #006699;
+ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size : 13px;
+ width: 100%;
+}
+.inv2{
+ color : #D6E6F9;
+ text-align : left;
+ background-color : #006699;
+ font-family : Verdana, Geneva, Arial, Helvetica, sans-serif;
+ font-size : 13px;
+ width: 100%;
+ font-weight: bold;
+}
+H4{
+ color : #006699;
+ text-align : center;
+ border-left-color: #996666;
+ padding-top: 0px;
+ padding-right: 0px;
+ padding-bottom: 0px;
+ padding-left: 10px;
+ border-style: solid;
+ border-top-width: 0px;
+ border-right-width: 0px;
+ border-bottom-width: 0px;
+ border-left-width : 0px;
+}
+H5{
+ color : #006699;
+ text-align : center;
+ border-left-color: #996666;
+ padding-top: 0px;
+ padding-right: 0px;
+ padding-bottom: 0px;
+ padding-left: 10px;
+ border-style: solid;
+ border-top-width: 0px;
+ border-right-width: 0px;
+ border-bottom-width: 0px;
+ border-left-width : 0px;
+}
+
+HR{
+ height: 3px;
+}
+#erlauet{
+ color : #006699;
+ text-align : left;
+ border-left-color: #996666;
+ padding: 5px 5px 5px 5px;
+
+}
+#darkblock{
+ background-color : #99CCFF;
+ text-align : left;
+ padding : 5px 5px 5px 5px;
+font-size : 13px;
+}
+#lightblock{
+ background-color : #D6E6F9;
+ text-align : left;
+ padding : 5px 5px 5px 5px;
+font-size : 13px;
+}
+.versiontext {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 6pt;
+ color: #6b6b6b;
+ font-style: normal;
+ text-decoration: none;
+ text-align: right;
+ padding-right : 5px;
+}
+.navitext {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 7pt;
+ font-weight: bold;
+ color: #000000;
+ font-style: normal;
+ text-decoration: underline;
+}
+.navitext:hover {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 7pt;
+ font-weight: bold;
+ color: black;
+ font-style: normal;
+ text-decoration: underline;
+}
+a.pagelinks {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 9pt;
+ color: #000000;
+}
+a.pagelinks:hover {
+ color: gray;
+}
+
+a.menulinks {
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-size: 10pt;
+ font-weight: normal;
+ color: #000000;
+ font-style: normal;
+ text-decoration: underline;
+}
+a.menulinks:hover {
+ text-decoration: underline;
+}
+.link_dbx
+{
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-weight: normal;
+ text-decoration: underline;
+ color: #000000;
+}
+.link_dbx:hover
+{
+ color: #000000;
+ text-decoration: underline;
+}
+.link_nav
+{
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-weight: normal;
+ text-decoration: underline;
+ color: #000000;
+}
+
+.link_nav:hover
+{
+ color : gray;
+ text-decoration: underline;
+}
+
+.link
+{
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-weight: bold;
+ text-decoration: underline;
+ color: #D6E5F8;
+}
+
+.link:hover
+{
+ color: white;
+}
+
+.link_fett
+{
+ font-family: Verdana, Arial, Helvetica, sans-serif;
+ font-weight: bold;
+ text-decoration: underline;
+ color: #D6E5F8;
+}
+.link_fett:hover
+{
+ color: #000000;
+ text-decoration: underline;
+}
+.header { font-family:Verdana,Arial,Helv; font-size:12px; margin-left:5px; font-weight:bold; text-decoration:none; color:#D6E5F8;}
+
+/* Definitionen für die Meldungen (hostmeld.inc) */
+.meld {
+background-color: white;
+color : black;
+padding: 5px;
+margin: 2px;
+margin-bottom: 10px;
+border: 6px solid;
+}
+.ok {
+border-color: #199919;
+}
+.fehler {
+border-color: #ff4c4c;
+}
+.hinweis {
+border-color: #003399;
+}
+.fehlerfeld {
+color: red;
+font-weight: bolder;
+}
+
+#tabheader {
+ color : #D6E6F9;
+ background-color : #6699CC;
+ font-size : 13px;
+ font-weight : bold;
+ padding : 5px;
+ padding-top:1px;
+ padding-bottom:1px;
+}
+#tab {
+ background-color : #D6E6F9;
+ margin-top: 2px;
+ padding : 5px;
+}
+
+
+/* ================================================================
+This copyright notice must be untouched at all times.
+
+The original version of this stylesheet and the associated (x)html
+is available at http://www.cssplay.co.uk/menus/simple_vertical.html
+Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
+This stylesheet and the associated (x)html may be modified in any
+way to fit your requirements.
+=================================================================== */
+
+/* Add a margin - for this demo only - and a relative position with a high z-index to make it appear over any element below */
+#menu_container {width:100%; height:22px; z-index:100; background-color: #cccccc;}
+
+/* Get rid of the margin, padding and bullets in the unordered lists */
+#pmenu, #pmenu ul {padding:0; margin:0; list-style-type: none;}
+
+/* Set up the link size, color and borders */
+#pmenu a, #pmenu a:visited {display:block; font-size:10pt; color:#000000; text-decoration:none; text-indent:5px;
+ border:1px solid; border-width:1px 0 1px 1px; border-bottom-color: gray; border-top-color: white;
+ border-left-color: white; border-right-color: gray;
+ min-height:20px;
+ line-height:20px;
+ height:20px;
+ height:auto !important;
+ }
+
+/* Breitenangaben mit child selector: funkt nicht mit IE < 7. */
+#pmenu > li > ul a {width:170px;} /* LVL 1 Diese Selektion haut im IE6 nicht hin */
+#pmenu > li > ul > li > ul a {width:200px;} /* LVL 2 Diese Selektion haut im IE6 nicht hin */
+/* Breitenangaben ohne child selector: für IE6 */
+#pmenu * a { width:100px; }
+#pmenu * * a { width:200px; }
+
+/* Set up the sub level borders */
+#pmenu li ul li a, #pmenu li ul li a:visited {border-width:0 1px 1px 1px;}
+#pmenu li a.enclose, #pmenu li a.enclose:visited {border-width:1px;}
+
+/* Set up the list items */
+#pmenu li {float:left; background:#cccccc;} /* orig: #7484ad;*/
+
+/* For Non-IE browsers and IE7 */
+#pmenu li:hover {position:relative;}
+/* Make the hovered list color persist */
+#pmenu li:hover > a {background:#006699; color:#ffffff;} /* orig: #dfd7ca;*/
+/* Set up the sublevel lists with a position absolute for flyouts and overrun padding. The transparent gif is for IE to work */
+#pmenu li ul {display:none;}
+/* For Non-IE and IE7 make the sublevels visible on list hover. This is all it needs */
+#pmenu li:hover > ul {display:block; position:absolute; top:-11px; left:80px; padding:10px 30px 30px 30px; background:transparent url('../graphics/transparent.gif'); width:120px;}
+/* Position the first sub level beneath the top level liinks */
+#pmenu > li:hover > ul {left:-30px; top:12px;}
+
+/* get rid of the table */
+#pmenu table {position:absolute; border-collapse:collapse; top:0; left:0; z-index:100; font-size:1em;}
+
+/* For IE5.5 and IE6 give the hovered links a position relative and a change of background and foreground color. This is needed to trigger IE to show the sub levels */
+* html #pmenu li a:hover {position:relative; background:#006699; color:#ffffff;} /* IE6: aktiv wenn Link hoovert */
+
+/* For accessibility of the top level menu when tabbing */
+#pmenu li a:active, #pmenu li a:focus {background:#006699; color:#ffffff;} /* IE6: aktiv wenn Link hoovert */
+
+/* Set up the pointers for the sub level indication */
+#pmenu li.fly {background:#cccccc url('../graphics/fly.gif') no-repeat right center;} /* orig: #7484ad;*/
+#pmenu li.drop {background:#cccccc url('../graphics/drop.gif') no-repeat right center;} /* orig: #7484ad;*/
+
+
+/* This lot is for IE5.5 and IE6 ONLY and is necessary to make the sublevels appear */
+
+/* change the drop down levels from display:none; to visibility:hidden; */
+* html #pmenu li ul { visibility:hidden; display:block; position:absolute; top:-11px; left:80px; padding:10px 30px 30px 30px; background:transparent url('../graphics/transparent.gif');}
+
+/* keep the third level+ hidden when you hover on first level link */
+#pmenu li a:hover ul ul{
+visibility:hidden;
+}
+/* keep the fourth level+ hidden when you hover on second level link */
+#pmenu li a:hover ul a:hover ul ul{
+visibility:hidden;
+}
+/* keep the fifth level hidden when you hover on third level link */
+#pmenu li a:hover ul a:hover ul a:hover ul ul{
+visibility:hidden;
+}
+/* keep the sixth level hidden when you hover on fourth level link */
+#pmenu li a:hover ul a:hover ul a:hover ul a:hover ul ul {
+visibility:hidden;
+}
+
+/* make the second level visible when hover on first level link and position it */
+#pmenu li a:hover ul {
+visibility:visible; left:-30px; top:14px; lef\t:-31px; to\p:15px;
+}
+
+/* make the third level visible when you hover over second level link and position it and all further levels */
+#pmenu li a:hover ul a:hover ul{
+visibility:visible; top:-11px; left:80px;
+}
+/* make the fourth level visible when you hover over third level link */
+#pmenu li a:hover ul a:hover ul a:hover ul {
+visibility:visible;
+}
+/* make the fifth level visible when you hover over fourth level link */
+#pmenu li a:hover ul a:hover ul a:hover ul a:hover ul {
+visibility:visible;
+}
+/* make the sixth level visible when you hover over fifth level link */
+#pmenu li a:hover ul a:hover ul a:hover ul a:hover ul a:hover ul {
+visibility:visible;
+}
+/* If you can see the pattern in the above IE5.5 and IE6 style then you can add as many sub levels as you like */
+
+@media print {
+ #menu_container, #hd, #np {display: none;}
+ #div_teiln {min-width: 20%;}
+ h1, h2, h3, h4, h5 {color: black;}
+}
diff --git a/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/index.css b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/index.css
new file mode 100644
index 00000000..2b7cee82
--- /dev/null
+++ b/BKUOnline/src/main/webapp/finanzonline/FinanzOnlineLogin/index.css
@@ -0,0 +1,101 @@
+ #leftcontent {
+ position: absolute;
+ left:10px;
+ top:120px;
+ width:210px;
+ border:0px solid #000;
+ }
+ #centercontent {
+ margin-left: 229px;
+ margin-right:229px;
+ margin-top: -2px;
+ /*
+ IE5x PC mis-implements the box model. Because of that we sometimes have
+ to perform a little CSS trickery to get pixel-perfect display across browsers.
+ The following bit of code was proposed by Tantek Celik, and it preys upon a CSS
+ parsing bug in IE5x PC that will prematurly close a style rule when it runs
+ into the string "\"}\"". After that string appears in a rule, then, we can override
+ previously set attribute values and only browsers without the parse bug will
+ recognize the new values. So any of the name-value pairs above this comment
+ that we need to override for browsers with correct box-model implementations
+ will be listed below.
+
+ We use the voice-family property because it is likely to be used very infrequently,
+ and where it is used it will be set on the body tag. So the second voice-family value
+ of "inherit" will override our bogus "\"}\"" value and allow the proper value to
+ cascade down from the body tag.
+
+ The style rule immediately following this rule offers another chance for CSS2
+ aware browsers to pick up the values meant for correct box-model implementations.
+ It uses a CSS2 selector that will be ignored by IE5x PC.
+
+ Read more at http://www.glish.com/css/hacks.asp
+
+
+ voice-family: "\"}\"";
+ voice-family: inherit;
+ margin-left: 201px;
+ margin-right:201px;*/
+ }
+ html>body #centercontent {
+ margin-left: 231px;
+ margin-right:231px;
+ }
+ #rightcontent {
+ position: absolute;
+ right:10px;
+ top:120px;
+ width:210px;
+ }
+ #banner {
+ height:120px;
+ }
+ html>body #banner {
+ height:120px;
+ }
+ #rightcontent p {
+ font-size:10px
+ }
+ #tabheader {
+ color : #D6E6F9;
+ background-color : #6699CC;
+ font-size : 13px;
+ font-weight : bold;
+ padding : 5px;
+ padding-top:1px;
+ padding-bottom:1px;
+ }
+ #tab {
+ background-color : #D6E6F9;
+ margin-top: 2px;
+ padding : 5px;
+ }
+ #navlist {
+ padding: 0px;
+ margin: 0px;
+ width: 100%;
+ background-color: #6699cc;
+ }
+ #navlist li {
+ list-style: none;
+ margin: 0;
+ padding: 0.25em;
+ padding-top: 0.3em;
+ padding-bottom: 0.3em;
+ border-bottom: 1px solid white;
+ }
+ a.nb {
+ font-family:Verdana,Arial,Helv;
+ font-size:12px;
+ margin-left:5px;
+ font-weight:bold;
+ text-decoration:underline;
+ color:#D6E6F9;
+ }
+ a.nb:hover {
+ color:white;
+ }
+
+ @media print {
+ #rightcontent {display: none;}
+ }
diff --git a/BKUOnline/src/main/webapp/finanzonline/iframe.html b/BKUOnline/src/main/webapp/finanzonline/iframe.html
new file mode 100644
index 00000000..ac2f6c93
--- /dev/null
+++ b/BKUOnline/src/main/webapp/finanzonline/iframe.html
@@ -0,0 +1,22 @@
+
+
+
+ bkuiframe
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BKUOnline/src/main/webapp/finanzonline/index.html b/BKUOnline/src/main/webapp/finanzonline/index.html
new file mode 100644
index 00000000..d47e8e63
--- /dev/null
+++ b/BKUOnline/src/main/webapp/finanzonline/index.html
@@ -0,0 +1,192 @@
+
+
+
+ FinanzOnline Login
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/BKUOnline/src/main/webapp/index.html b/BKUOnline/src/main/webapp/index.html
index 8f1a338e..bf8b3ae0 100644
--- a/BKUOnline/src/main/webapp/index.html
+++ b/BKUOnline/src/main/webapp/index.html
@@ -49,6 +49,8 @@
TestRequest
Security Layer Request
+FinanzOnline
+FinanzOnline Demo Integration
STAL Service
STAL Service Endpoint Information
diff --git a/BKUOnline/src/test/resources/appletTest.html b/BKUOnline/src/test/resources/appletTest.html
index bf24a2c9..71f09a93 100644
--- a/BKUOnline/src/test/resources/appletTest.html
+++ b/BKUOnline/src/test/resources/appletTest.html
@@ -22,7 +22,7 @@
width=380 height=160>
-
+
--
cgit v1.2.3
From f993d336e51b9f7898aeeff2e5ae6785066d1e5b Mon Sep 17 00:00:00 2001
From: clemenso
Date: Thu, 9 Oct 2008 16:23:52 +0000
Subject: demo integration beta1
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@94 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
BKUApplet/hs_err_pid32072.log | 453 +++++++++++++++++++++
.../at/gv/egiz/bku/online/applet/BKUApplet.java | 17 +-
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 7 +-
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 3 +-
.../main/java/at/gv/egiz/bku/gui/ImagePanel.java | 37 ++
.../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 38 +-
.../at/gv/egiz/bku/gui/Messages.properties | 2 +-
BKUCommonGUI/src/main/resources/images/mocca.png | Bin 0 -> 1450 bytes
.../src/main/resources/images/mocca_default.png | Bin 0 -> 1287 bytes
.../src/main/resources/images/mocca_tiny.png | Bin 0 -> 1025 bytes
.../test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 2 +-
BKUOnline/src/main/webapp/META-INF/context.xml | 1 +
BKUOnline/src/main/webapp/appletPage.jsp | 2 +-
BKUOnline/src/main/webapp/index.html | 2 -
14 files changed, 542 insertions(+), 22 deletions(-)
create mode 100644 BKUApplet/hs_err_pid32072.log
create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java
create mode 100644 BKUCommonGUI/src/main/resources/images/mocca.png
create mode 100644 BKUCommonGUI/src/main/resources/images/mocca_default.png
create mode 100644 BKUCommonGUI/src/main/resources/images/mocca_tiny.png
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUApplet/hs_err_pid32072.log b/BKUApplet/hs_err_pid32072.log
new file mode 100644
index 00000000..cf86d1c5
--- /dev/null
+++ b/BKUApplet/hs_err_pid32072.log
@@ -0,0 +1,453 @@
+#
+# An unexpected error has been detected by Java Runtime Environment:
+#
+# SIGBUS (0x7) at pc=0xb7bcbc53, pid=32072, tid=3033660304
+#
+# Java VM: Java HotSpot(TM) Client VM (10.0-b22 mixed mode, sharing linux-x86)
+# Problematic frame:
+# C [libzip.so+0xbc53]
+#
+# If you would like to submit a bug report, please visit:
+# http://java.sun.com/webapps/bugreport/crash.jsp
+# The crash happened outside the Java Virtual Machine in native code.
+# See problematic frame for where to report the bug.
+#
+
+--------------- T H R E A D ---------------
+
+Current thread (0xb4faa400): JavaThread "Thread-2" [_thread_in_native, id=32091, stack(0xb4ccf000,0xb4d20000)]
+
+siginfo:si_signo=SIGBUS: si_errno=0, si_code=2 (BUS_ADRERR), si_addr=0xb5804fc0
+
+Registers:
+EAX=0x080576a8, EBX=0xb7bd07bc, ECX=0xb5803000, EDX=0x0002d000
+ESP=0xb4d1dc10, EBP=0xb4d1dc38, ESI=0xb5804fa3, EDI=0x0839b310
+EIP=0xb7bcbc53, CR2=0xb5804fc0, EFLAGS=0x00210286
+
+Top of Stack: (sp=0xb4d1dc10)
+0xb4d1dc10: 00000030 b4fa9370 b4fa9378 b4fa9764
+0xb4d1dc20: 08057568 08057568 b7bcbc0b b7bd07bc
+0xb4d1dc30: 0828f3cc 00000000 b4d1dc68 b7bcc00b
+0xb4d1dc40: 080576a8 0828f3cc 00000000 00000000
+0xb4d1dc50: b4faa400 00000004 87c67713 b7bd07bc
+0xb4d1dc60: b4d1dcb0 b4faa4f4 b4d1e0d8 b7bc31b9
+0xb4d1dc70: 080576a8 b4d1dcb0 00000025 00000025
+0xb4d1dc80: b4d1dcb0 6c706d69 49554765 2e303124
+
+Instructions: (pc=0xb7bcbc53)
+0xb7bcbc43: 8b 70 04 8b 45 08 8b 48 10 8b 50 1c 01 ce 29 d6
+0xb7bcbc53: 0f b6 46 1d 0f b6 56 1c c1 e0 08 09 c2 89 55 f0
+
+Stack: [0xb4ccf000,0xb4d20000], sp=0xb4d1dc10, free space=315k
+Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
+C [libzip.so+0xbc53]
+C [libzip.so+0xc00b] ZIP_GetEntry+0x10b
+C [libzip.so+0x31b9] Java_java_util_zip_ZipFile_getEntry+0xc9
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+J sun.misc.URLClassPath$JarLoader.getResource(Ljava/lang/String;Z)Lsun/misc/Resource;
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::StubRoutines (1)
+V [libjvm.so+0x21c5cd]
+V [libjvm.so+0x310748]
+V [libjvm.so+0x21c460]
+V [libjvm.so+0x272313]
+C [libjava.so+0xaa5c] Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2+0x3c
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::StubRoutines (1)
+V [libjvm.so+0x21c5cd]
+V [libjvm.so+0x310748]
+V [libjvm.so+0x21c0f1]
+V [libjvm.so+0x21c1da]
+V [libjvm.so+0x375867]
+V [libjvm.so+0x374305]
+V [libjvm.so+0x373377]
+V [libjvm.so+0x373082]
+V [libjvm.so+0x1bc043]
+V [libjvm.so+0x20c8e6]
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::StubRoutines (1)
+V [libjvm.so+0x21c5cd]
+V [libjvm.so+0x310748]
+V [libjvm.so+0x21bee0]
+V [libjvm.so+0x21bf6d]
+V [libjvm.so+0x28c175]
+V [libjvm.so+0x391f8d]
+V [libjvm.so+0x3113f9]
+C [libpthread.so.0+0x54fb]
+
+Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+J sun.misc.URLClassPath$JarLoader.getResource(Ljava/lang/String;Z)Lsun/misc/Resource;
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::StubRoutines (1)
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::StubRoutines (1)
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::Interpreter
+v ~BufferBlob::StubRoutines (1)
+
+--------------- P R O C E S S ---------------
+
+Java Threads: ( => current thread )
+ 0xb5702400 JavaThread "Thread-3" [_thread_blocked, id=32217, stack(0xb4c7e000,0xb4ccf000)]
+=>0xb4faa400 JavaThread "Thread-2" [_thread_in_native, id=32091, stack(0xb4ccf000,0xb4d20000)]
+ 0x0828e400 JavaThread "AWT-EventQueue-1" [_thread_blocked, id=32089, stack(0xb4eaf000,0xb4f00000)]
+ 0xb57b9400 JavaThread "TimerQueue" daemon [_thread_blocked, id=32088, stack(0xb4dd5000,0xb4e26000)]
+ 0xb4f8a400 JavaThread "DestroyJavaVM" [_thread_blocked, id=32073, stack(0xb7c43000,0xb7c94000)]
+ 0xb57a1400 JavaThread "AWT-EventQueue-0" [_thread_blocked, id=32086, stack(0xb507f000,0xb50d0000)]
+ 0xb57a0800 JavaThread "AWT-Shutdown" [_thread_blocked, id=32085, stack(0xb50d0000,0xb5121000)]
+ 0xb5792000 JavaThread "AWT-XAWT" daemon [_thread_in_native, id=32082, stack(0xb520c000,0xb525d000)]
+ 0xb5751000 JavaThread "Java2D Disposer" daemon [_thread_blocked, id=32081, stack(0xb5285000,0xb52d6000)]
+ 0xb5700c00 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=32079, stack(0xb5823000,0xb5874000)]
+ 0x0808c000 JavaThread "CompilerThread0" daemon [_thread_blocked, id=32078, stack(0xb5874000,0xb58f5000)]
+ 0x0808ac00 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=32077, stack(0xb58f5000,0xb5946000)]
+ 0x08081c00 JavaThread "Finalizer" daemon [_thread_blocked, id=32076, stack(0xb598c000,0xb59dd000)]
+ 0x08080c00 JavaThread "Reference Handler" daemon [_thread_blocked, id=32075, stack(0xb59dd000,0xb5a2e000)]
+
+Other Threads:
+ 0x0807f400 VMThread [stack: 0xb5a2e000,0xb5aaf000] [id=32074]
+ 0xb570a400 WatcherThread [stack: 0xb567f000,0xb5700000] [id=32080]
+
+VM state:not at safepoint (normal execution)
+
+VM Mutex/Monitor currently owned by a thread: None
+
+Heap
+ def new generation total 960K, used 512K [0x8bfe0000, 0x8c0e0000, 0x8c4c0000)
+ eden space 896K, 50% used [0x8bfe0000, 0x8c050378, 0x8c0c0000)
+ from space 64K, 100% used [0x8c0d0000, 0x8c0e0000, 0x8c0e0000)
+ to space 64K, 0% used [0x8c0c0000, 0x8c0c0000, 0x8c0d0000)
+ tenured generation total 4096K, used 3837K [0x8c4c0000, 0x8c8c0000, 0x8ffe0000)
+ the space 4096K, 93% used [0x8c4c0000, 0x8c87f6a0, 0x8c87f800, 0x8c8c0000)
+ compacting perm gen total 12288K, used 6940K [0x8ffe0000, 0x90be0000, 0x93fe0000)
+ the space 12288K, 56% used [0x8ffe0000, 0x906a7308, 0x906a7400, 0x90be0000)
+ ro space 8192K, 73% used [0x93fe0000, 0x945c34a0, 0x945c3600, 0x947e0000)
+ rw space 12288K, 58% used [0x947e0000, 0x94ed8668, 0x94ed8800, 0x953e0000)
+
+Dynamic libraries:
+06000000-0641b000 r-xp 00000000 08:02 1085428 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/libjvm.so
+0641b000-06435000 rwxp 0041a000 08:02 1085428 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/libjvm.so
+06435000-06855000 rwxp 06435000 00:00 0
+08048000-08052000 r-xp 00000000 08:02 1085534 /usr/lib/jvm/java-6-sun-1.6.0.06/bin/appletviewer
+08052000-08053000 rwxp 00009000 08:02 1085534 /usr/lib/jvm/java-6-sun-1.6.0.06/bin/appletviewer
+08053000-083f5000 rwxp 08053000 00:00 0 [heap]
+8bfe0000-8c0e0000 rwxp 8bfe0000 00:00 0
+8c0e0000-8c4c0000 rwxp 8c0e0000 00:00 0
+8c4c0000-8c8c0000 rwxp 8c4c0000 00:00 0
+8c8c0000-8ffe0000 rwxp 8c8c0000 00:00 0
+8ffe0000-90be0000 rwxp 8ffe0000 00:00 0
+90be0000-93fe0000 rwxp 90be0000 00:00 0
+93fe0000-945c4000 r-xs 00001000 08:02 1081430 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/classes.jsa
+945c4000-947e0000 rwxp 945c4000 00:00 0
+947e0000-94ed9000 rwxp 005e5000 08:02 1081430 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/classes.jsa
+94ed9000-953e0000 rwxp 94ed9000 00:00 0
+953e0000-954b9000 rwxp 00cde000 08:02 1081430 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/classes.jsa
+954b9000-957e0000 rwxp 954b9000 00:00 0
+957e0000-957e4000 r-xs 00db7000 08:02 1081430 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client/classes.jsa
+957e4000-95be0000 rwxp 957e4000 00:00 0
+b4c7e000-b4c81000 ---p b4c7e000 00:00 0
+b4c81000-b4ccf000 rwxp b4c81000 00:00 0
+b4ccf000-b4cd2000 ---p b4ccf000 00:00 0
+b4cd2000-b4d20000 rwxp b4cd2000 00:00 0
+b4d20000-b4d23000 r-xs 00000000 08:02 3560016 /var/cache/fontconfig/5e10083637a12ecd1bff191eb66bfa2f-x86.cache-2
+b4d23000-b4d29000 r-xs 00000000 08:02 3560014 /var/cache/fontconfig/945677eb7aeaf62f1d50efc3fb3ec7d8-x86.cache-2
+b4d29000-b4d2c000 r-xs 00000000 08:02 3560019 /var/cache/fontconfig/e383d7ea5fbe662a33d9b44caf393297-x86.cache-2
+b4d2c000-b4d31000 r-xs 00000000 08:02 3560011 /var/cache/fontconfig/bddabcf04192498a6a74911686fc6962-x86.cache-2
+b4d31000-b4d34000 r-xs 00000000 08:02 3556212 /var/cache/fontconfig/a46337af8a0b4c9b317ad981ec3bdf87-x86.cache-2
+b4d34000-b4d35000 r-xs 00000000 08:02 3560013 /var/cache/fontconfig/fd9505950c048a77dc4b710eb6a628ed-x86.cache-2
+b4d35000-b4d37000 r-xs 00000000 08:02 3560021 /var/cache/fontconfig/ddc79d3ea06a7c6ffa86ede85f3bb5df-x86.cache-2
+b4d37000-b4d38000 r-xs 00000000 08:02 3560164 /var/cache/fontconfig/e3fa16a14183b06aa45b3e009278fd14-x86.cache-2
+b4d38000-b4d39000 r-xs 00000000 08:02 3560125 /var/cache/fontconfig/e7071f4a29fa870f4323321c154eba04-x86.cache-2
+b4d39000-b4d3a000 r-xs 00000000 08:02 3560023 /var/cache/fontconfig/a2ab74764b07279e7c36ddb1d302cf26-x86.cache-2
+b4d3a000-b4d3e000 r-xs 00000000 08:02 3560003 /var/cache/fontconfig/921a30a17f0be15c70ac14043cb7a739-x86.cache-2
+b4d3e000-b4d3f000 r-xs 00000000 08:02 3560018 /var/cache/fontconfig/c69f04ab05004e31a6d5e715764f16d8-x86.cache-2
+b4d3f000-b4d40000 r-xs 00000000 08:02 3560008 /var/cache/fontconfig/4c73fe0c47614734b17d736dbde7580a-x86.cache-2
+b4d40000-b4d42000 r-xs 00000000 08:02 3560007 /var/cache/fontconfig/646addb8444faa74ee138aa00ab0b6a0-x86.cache-2
+b4d42000-b4d45000 r-xs 00000000 08:02 3560006 /var/cache/fontconfig/a755afe4a08bf5b97852ceb7400b47bc-x86.cache-2
+b4d45000-b4d47000 r-xs 00000000 08:02 3560015 /var/cache/fontconfig/20bd79ad97094406f7d1b9654bfbd926-x86.cache-2
+b4d47000-b4d49000 r-xs 00000000 08:02 3560009 /var/cache/fontconfig/9c0624108b9a2ae8552f664125be8356-x86.cache-2
+b4d49000-b4d50000 r-xs 00000000 08:02 3560004 /var/cache/fontconfig/6d41288fd70b0be22e8c3a91e032eec0-x86.cache-2
+b4d50000-b4d53000 r-xs 00000000 08:02 3560012 /var/cache/fontconfig/de156ccd2eddbdc19d37a45b8b2aac9c-x86.cache-2
+b4d53000-b4d55000 r-xs 00000000 08:02 3556204 /var/cache/fontconfig/da1bd5ca8443ffe22927a23ce431d198-x86.cache-2
+b4d55000-b4d5d000 r-xs 00000000 08:02 3560169 /var/cache/fontconfig/e3de0de479f42330eadf588a55fb5bf4-x86.cache-2
+b4d5d000-b4d65000 r-xs 00000000 08:02 2409868 /var/cache/fontconfig/0f34bcd4b6ee430af32735b75db7f02b-x86.cache-2
+b4d65000-b4d66000 r-xs 00000000 08:02 3560126 /var/cache/fontconfig/4794a0821666d79190d59a36cb4f44b5-x86.cache-2
+b4d66000-b4d88000 r-xs 00000000 08:02 1392718 /var/cache/fontconfig/365b55f210c0a22e9a19e35191240f32-x86.cache-2
+b4d88000-b4d8a000 r-xs 00000000 08:02 3560017 /var/cache/fontconfig/2c5ba8142dffc8bf0377700342b8ca1a-x86.cache-2
+b4d8a000-b4d8d000 r-xs 00000000 08:02 3560022 /var/cache/fontconfig/de9486f0b47a4d768a594cb4198cb1c6-x86.cache-2
+b4d8d000-b4d94000 r-xs 00000000 08:02 3556202 /var/cache/fontconfig/d52a8644073d54c13679302ca1180695-x86.cache-2
+b4d94000-b4d99000 r-xs 00000000 08:02 3558093 /var/cache/fontconfig/105b9c7e6f0a4f82d8c9b6e39c52c6f9-x86.cache-2
+b4d99000-b4d9c000 r-xs 00000000 08:02 3560677 /var/cache/fontconfig/6386b86020ecc1ef9690bb720a13964f-x86.cache-2
+b4d9c000-b4da7000 r-xs 00000000 08:02 3556115 /var/cache/fontconfig/089dead882dea3570ffc31a9898cfb69-x86.cache-2
+b4da7000-b4db4000 r-xs 00000000 08:02 2409873 /var/cache/fontconfig/e13b20fdb08344e0e664864cc2ede53d-x86.cache-2
+b4dd5000-b4dd8000 ---p b4dd5000 00:00 0
+b4dd8000-b4e26000 rwxp b4dd8000 00:00 0
+b4e3b000-b4e46000 rwxs 00000000 00:09 1831534605 /SYSV00000000 (deleted)
+b4e46000-b4e47000 r--s 0000f000 00:11 751021 /var/run/pcscd/pcscd.pub
+b4e47000-b4e48000 r--s 0000e000 00:11 751021 /var/run/pcscd/pcscd.pub
+b4e48000-b4e49000 r--s 0000d000 00:11 751021 /var/run/pcscd/pcscd.pub
+b4e49000-b4e4a000 r--s 0000c000 00:11 751021 /var/run/pcscd/pcscd.pub
+b4e4a000-b4e4b000 r--s 0000b000 00:11 751021 /var/run/pcscd/pcscd.pub
+b4e4b000-b4e4c000 r--s 0000a000 00:11 751021 /var/run/pcscd/pcscd.pub
+b4e4c000-b4e4d000 r--s 00009000 00:11 751021 /var/run/pcscd/pcscd.pub
+b4e4d000-b4e4e000 r--s 00008000 00:11 751021 /var/run/pcscd/pcscd.pub
+b4e4e000-b4e4f000 r--s 00007000 00:11 751021 /var/run/pcscd/pcscd.pub
+b4e4f000-b4e50000 r--s 00006000 00:11 751021 /var/run/pcscd/pcscd.pub
+b4e50000-b4e51000 r--s 00005000 00:11 751021 /var/run/pcscd/pcscd.pub
+b4e51000-b4e52000 r--s 00004000 00:11 751021 /var/run/pcscd/pcscd.pub
+b4e52000-b4e5a000 r-xp 00000000 08:02 901283 /usr/lib/libpcsclite.so.1.0.0
+b4e5a000-b4e5b000 rwxp 00008000 08:02 901283 /usr/lib/libpcsclite.so.1.0.0
+b4e5b000-b4e5d000 r-xp 00000000 08:02 1085449 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libj2pcsc.so
+b4e5d000-b4e5e000 rwxp 00001000 08:02 1085449 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libj2pcsc.so
+b4e5e000-b4e61000 rwxp b4e5e000 00:00 0
+b4e61000-b4eaf000 rwxp b4e61000 00:00 0
+b4eaf000-b4eb2000 ---p b4eaf000 00:00 0
+b4eb2000-b4fd2000 rwxp b4eb2000 00:00 0
+b4fd2000-b5000000 ---p b4fd2000 00:00 0
+b5000000-b5001000 r--s 00003000 00:11 751021 /var/run/pcscd/pcscd.pub
+b5001000-b5004000 r-xs 00027000 08:02 1086682 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/ext/sunjce_provider.jar
+b5004000-b5036000 rwxp b5004000 00:00 0
+b5036000-b503a000 r-xs 00000000 08:02 3555788 /var/cache/fontconfig/4a195c91033ef4528a35b4a1ac51414e-x86.cache-2
+b503a000-b5048000 r-xs 00000000 08:02 3557818 /var/cache/fontconfig/865f88548240fee46819705c6468c165-x86.cache-2
+b5048000-b504f000 r-xs 00110000 08:02 1065527 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/resources.jar
+b504f000-b5077000 rwxp b504f000 00:00 0
+b5077000-b507e000 r-xp 00000000 08:02 1085443 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libnio.so
+b507e000-b507f000 rwxp 00006000 08:02 1085443 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libnio.so
+b507f000-b5082000 ---p b507f000 00:00 0
+b5082000-b50d0000 rwxp b5082000 00:00 0
+b50d0000-b50d3000 ---p b50d0000 00:00 0
+b50d3000-b5121000 rwxp b50d3000 00:00 0
+b5121000-b5124000 r-xs 00000000 08:02 3560016 /var/cache/fontconfig/5e10083637a12ecd1bff191eb66bfa2f-x86.cache-2
+b5124000-b512a000 r-xs 00000000 08:02 3560014 /var/cache/fontconfig/945677eb7aeaf62f1d50efc3fb3ec7d8-x86.cache-2
+b512a000-b512d000 r-xs 00000000 08:02 3560019 /var/cache/fontconfig/e383d7ea5fbe662a33d9b44caf393297-x86.cache-2
+b512d000-b5132000 r-xs 00000000 08:02 3560011 /var/cache/fontconfig/bddabcf04192498a6a74911686fc6962-x86.cache-2
+b5132000-b5135000 r-xs 00000000 08:02 3556212 /var/cache/fontconfig/a46337af8a0b4c9b317ad981ec3bdf87-x86.cache-2
+b5135000-b5136000 r-xs 00000000 08:02 3560013 /var/cache/fontconfig/fd9505950c048a77dc4b710eb6a628ed-x86.cache-2
+b5136000-b5138000 r-xs 00000000 08:02 3560021 /var/cache/fontconfig/ddc79d3ea06a7c6ffa86ede85f3bb5df-x86.cache-2
+b5138000-b5139000 r-xs 00000000 08:02 3560164 /var/cache/fontconfig/e3fa16a14183b06aa45b3e009278fd14-x86.cache-2
+b5139000-b513a000 r-xs 00000000 08:02 3560125 /var/cache/fontconfig/e7071f4a29fa870f4323321c154eba04-x86.cache-2
+b513a000-b513b000 r-xs 00000000 08:02 3560023 /var/cache/fontconfig/a2ab74764b07279e7c36ddb1d302cf26-x86.cache-2
+b513b000-b513f000 r-xs 00000000 08:02 3560003 /var/cache/fontconfig/921a30a17f0be15c70ac14043cb7a739-x86.cache-2
+b513f000-b5140000 r-xs 00000000 08:02 3560018 /var/cache/fontconfig/c69f04ab05004e31a6d5e715764f16d8-x86.cache-2
+b5140000-b5141000 r-xs 00000000 08:02 3560008 /var/cache/fontconfig/4c73fe0c47614734b17d736dbde7580a-x86.cache-2
+b5141000-b5143000 r-xs 00000000 08:02 3560007 /var/cache/fontconfig/646addb8444faa74ee138aa00ab0b6a0-x86.cache-2
+b5143000-b5146000 r-xs 00000000 08:02 3560006 /var/cache/fontconfig/a755afe4a08bf5b97852ceb7400b47bc-x86.cache-2
+b5146000-b5148000 r-xs 00000000 08:02 3560015 /var/cache/fontconfig/20bd79ad97094406f7d1b9654bfbd926-x86.cache-2
+b5148000-b514a000 r-xs 00000000 08:02 3560009 /var/cache/fontconfig/9c0624108b9a2ae8552f664125be8356-x86.cache-2
+b514a000-b5151000 r-xs 00000000 08:02 3560004 /var/cache/fontconfig/6d41288fd70b0be22e8c3a91e032eec0-x86.cache-2
+b5151000-b5154000 r-xs 00000000 08:02 3560012 /var/cache/fontconfig/de156ccd2eddbdc19d37a45b8b2aac9c-x86.cache-2
+b5154000-b5156000 r-xs 00000000 08:02 3556204 /var/cache/fontconfig/da1bd5ca8443ffe22927a23ce431d198-x86.cache-2
+b5156000-b515e000 r-xs 00000000 08:02 3560169 /var/cache/fontconfig/e3de0de479f42330eadf588a55fb5bf4-x86.cache-2
+b515e000-b5166000 r-xs 00000000 08:02 2409868 /var/cache/fontconfig/0f34bcd4b6ee430af32735b75db7f02b-x86.cache-2
+b5166000-b5167000 r-xs 00000000 08:02 3560126 /var/cache/fontconfig/4794a0821666d79190d59a36cb4f44b5-x86.cache-2
+b5167000-b5189000 r-xs 00000000 08:02 1392718 /var/cache/fontconfig/365b55f210c0a22e9a19e35191240f32-x86.cache-2
+b5189000-b518b000 r-xs 00000000 08:02 3560017 /var/cache/fontconfig/2c5ba8142dffc8bf0377700342b8ca1a-x86.cache-2
+b518b000-b518e000 r-xs 00000000 08:02 3560022 /var/cache/fontconfig/de9486f0b47a4d768a594cb4198cb1c6-x86.cache-2
+b518e000-b5195000 r-xs 00000000 08:02 3556202 /var/cache/fontconfig/d52a8644073d54c13679302ca1180695-x86.cache-2
+b5195000-b519a000 r-xs 00000000 08:02 3558093 /var/cache/fontconfig/105b9c7e6f0a4f82d8c9b6e39c52c6f9-x86.cache-2
+b519a000-b519d000 r-xs 00000000 08:02 3560677 /var/cache/fontconfig/6386b86020ecc1ef9690bb720a13964f-x86.cache-2
+b519d000-b51a8000 r-xs 00000000 08:02 3556115 /var/cache/fontconfig/089dead882dea3570ffc31a9898cfb69-x86.cache-2
+b51a8000-b51b5000 r-xs 00000000 08:02 2409873 /var/cache/fontconfig/e13b20fdb08344e0e664864cc2ede53d-x86.cache-2
+b51b5000-b51bb000 r-xs 00091000 08:02 1065704 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/jsse.jar
+b51bb000-b51be000 rwxp b51bb000 00:00 0
+b51be000-b520c000 rwxp b51be000 00:00 0
+b520c000-b520f000 ---p b520c000 00:00 0
+b520f000-b525d000 rwxp b520f000 00:00 0
+b525d000-b5264000 r-xp 00000000 08:02 1343649 /usr/lib/libXrender.so.1.3.0
+b5264000-b5265000 rwxp 00007000 08:02 1343649 /usr/lib/libXrender.so.1.3.0
+b5265000-b526d000 r-xp 00000000 08:02 1343710 /usr/lib/libXcursor.so.1.0.2
+b526d000-b526e000 rwxp 00007000 08:02 1343710 /usr/lib/libXcursor.so.1.0.2
+b526e000-b526f000 r--s 00002000 00:11 751021 /var/run/pcscd/pcscd.pub
+b526f000-b5271000 r-xs 00017000 08:02 4065150 /home/clemens/workspace/mocca/BKUApplet/target/test-libs/iaik_jce_me4se-3.04.jar
+b5271000-b5284000 r-xp 00000000 08:02 1085442 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libnet.so
+b5284000-b5285000 rwxp 00013000 08:02 1085442 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libnet.so
+b5285000-b5288000 ---p b5285000 00:00 0
+b5288000-b52d6000 rwxp b5288000 00:00 0
+b52d6000-b5354000 r-xp 00000000 08:02 1085586 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libfontmanager.so
+b5354000-b535e000 rwxp 0007e000 08:02 1085586 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libfontmanager.so
+b535e000-b5363000 rwxp b535e000 00:00 0
+b5363000-b536a000 r-xp 00000000 08:02 1343653 /usr/lib/libXi.so.6.0.0
+b536a000-b536b000 rwxp 00006000 08:02 1343653 /usr/lib/libXi.so.6.0.0
+b536b000-b5378000 r-xp 00000000 08:02 902010 /usr/lib/libXext.so.6.4.0
+b5378000-b5379000 rwxp 0000d000 08:02 902010 /usr/lib/libXext.so.6.4.0
+b5379000-b53ba000 r-xp 00000000 08:02 1085581 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/xawt/libmawt.so
+b53ba000-b53bd000 rwxp 00040000 08:02 1085581 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/xawt/libmawt.so
+b53bd000-b5438000 r-xp 00000000 08:02 1085578 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libawt.so
+b5438000-b543f000 rwxp 0007b000 08:02 1085578 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libawt.so
+b543f000-b5463000 rwxp b543f000 00:00 0
+b5463000-b54c2000 r-xs 00b89000 08:02 1085573 /usr/lib/jvm/java-6-sun-1.6.0.06/lib/tools.jar
+b54c2000-b54f4000 rwxp b54c2000 00:00 0
+b54f4000-b567f000 r-xs 02df0000 08:02 1065570 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/rt.jar
+b567f000-b5680000 ---p b567f000 00:00 0
+b5680000-b5800000 rwxp b5680000 00:00 0
+b5800000-b5801000 r--s 00001000 00:11 751021 /var/run/pcscd/pcscd.pub
+b5801000-b5803000 r-xs 0000d000 08:02 4065123 /home/clemens/workspace/mocca/BKUApplet/target/test-libs/commons-logging-1.1.1.jar
+b5803000-b5807000 r-xs 0002d000 08:02 4050367 /home/clemens/workspace/mocca/BKUApplet/target/BKUApplet-1.0-SNAPSHOT.jar
+b5807000-b580b000 r-xp 00000000 08:02 1343688 /usr/lib/libXtst.so.6.1.0
+b580b000-b580c000 rwxp 00003000 08:02 1343688 /usr/lib/libXtst.so.6.1.0
+b580c000-b5810000 r-xp 00000000 08:02 905383 /usr/lib/libXfixes.so.3.1.0
+b5810000-b5811000 rwxp 00003000 08:02 905383 /usr/lib/libXfixes.so.3.1.0
+b5811000-b5815000 r-xs 00000000 08:02 3555788 /var/cache/fontconfig/4a195c91033ef4528a35b4a1ac51414e-x86.cache-2
+b5815000-b5823000 r-xs 00000000 08:02 3557818 /var/cache/fontconfig/865f88548240fee46819705c6468c165-x86.cache-2
+b5823000-b5826000 ---p b5823000 00:00 0
+b5826000-b5874000 rwxp b5826000 00:00 0
+b5874000-b5877000 ---p b5874000 00:00 0
+b5877000-b58f5000 rwxp b5877000 00:00 0
+b58f5000-b58f8000 ---p b58f5000 00:00 0
+b58f8000-b5946000 rwxp b58f8000 00:00 0
+b5946000-b594d000 r-xs 00000000 08:02 912666 /usr/lib/gconv/gconv-modules.cache
+b594d000-b598c000 r-xp 00000000 08:02 2162962 /usr/lib/locale/de_AT.utf8/LC_CTYPE
+b598c000-b598f000 ---p b598c000 00:00 0
+b598f000-b59dd000 rwxp b598f000 00:00 0
+b59dd000-b59e0000 ---p b59dd000 00:00 0
+b59e0000-b5a2e000 rwxp b59e0000 00:00 0
+b5a2e000-b5a2f000 ---p b5a2e000 00:00 0
+b5a2f000-b5abd000 rwxp b5a2f000 00:00 0
+b5abd000-b5ad7000 rwxp b5abd000 00:00 0
+b5ad7000-b5ada000 rwxp b5ad7000 00:00 0
+b5ada000-b5af5000 rwxp b5ada000 00:00 0
+b5af5000-b5af6000 rwxp b5af5000 00:00 0
+b5af6000-b5af7000 rwxp b5af6000 00:00 0
+b5af7000-b5afa000 rwxp b5af7000 00:00 0
+b5afa000-b5b15000 rwxp b5afa000 00:00 0
+b5b15000-b5b1b000 rwxp b5b15000 00:00 0
+b5b1b000-b5b35000 rwxp b5b1b000 00:00 0
+b5b35000-b5b46000 rwxp b5b35000 00:00 0
+b5b46000-b5bc0000 rwxp b5b46000 00:00 0
+b5bc0000-b5d10000 rwxp b5bc0000 00:00 0
+b5d10000-b7bc0000 rwxp b5d10000 00:00 0
+b7bc0000-b7bcf000 r-xp 00000000 08:02 1085437 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libzip.so
+b7bcf000-b7bd1000 rwxp 0000e000 08:02 1085437 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libzip.so
+b7bd1000-b7bf4000 r-xp 00000000 08:02 1085434 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libjava.so
+b7bf4000-b7bf6000 rwxp 00023000 08:02 1085434 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libjava.so
+b7bf6000-b7bff000 r-xp 00000000 08:02 2785878 /lib/tls/i686/cmov/libnss_files-2.7.so
+b7bff000-b7c01000 rwxp 00008000 08:02 2785878 /lib/tls/i686/cmov/libnss_files-2.7.so
+b7c01000-b7c09000 r-xp 00000000 08:02 2785986 /lib/tls/i686/cmov/libnss_nis-2.7.so
+b7c09000-b7c0b000 rwxp 00007000 08:02 2785986 /lib/tls/i686/cmov/libnss_nis-2.7.so
+b7c0b000-b7c1f000 r-xp 00000000 08:02 2785874 /lib/tls/i686/cmov/libnsl-2.7.so
+b7c1f000-b7c21000 rwxp 00013000 08:02 2785874 /lib/tls/i686/cmov/libnsl-2.7.so
+b7c21000-b7c23000 rwxp b7c21000 00:00 0
+b7c23000-b7c24000 r--s 00000000 00:11 751021 /var/run/pcscd/pcscd.pub
+b7c24000-b7c25000 r-xs 00000000 08:02 3556750 /var/cache/fontconfig/4c599c202bc5c08e2d34565a40eac3b2-x86.cache-2
+b7c25000-b7c26000 r-xs 00000000 08:02 3556750 /var/cache/fontconfig/4c599c202bc5c08e2d34565a40eac3b2-x86.cache-2
+b7c26000-b7c31000 r-xp 00000000 08:02 1085433 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libverify.so
+b7c31000-b7c32000 rwxp 0000b000 08:02 1085433 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/libverify.so
+b7c32000-b7c3a000 rwxs 00000000 08:02 1328188 /tmp/hsperfdata_clemens/32072
+b7c3a000-b7c41000 r-xp 00000000 08:02 2786023 /lib/tls/i686/cmov/librt-2.7.so
+b7c41000-b7c43000 rwxp 00006000 08:02 2786023 /lib/tls/i686/cmov/librt-2.7.so
+b7c43000-b7c46000 ---p b7c43000 00:00 0
+b7c46000-b7c94000 rwxp b7c46000 00:00 0
+b7c94000-b7cb7000 r-xp 00000000 08:02 2785871 /lib/tls/i686/cmov/libm-2.7.so
+b7cb7000-b7cb9000 rwxp 00023000 08:02 2785871 /lib/tls/i686/cmov/libm-2.7.so
+b7cb9000-b7cba000 rwxp b7cb9000 00:00 0
+b7cba000-b7cbe000 r-xp 00000000 08:02 905230 /usr/lib/libXdmcp.so.6.0.0
+b7cbe000-b7cbf000 rwxp 00003000 08:02 905230 /usr/lib/libXdmcp.so.6.0.0
+b7cbf000-b7cc1000 r-xp 00000000 08:02 901311 /usr/lib/libXau.so.6.0.0
+b7cc1000-b7cc2000 rwxp 00001000 08:02 901311 /usr/lib/libXau.so.6.0.0
+b7cc2000-b7cd9000 r-xp 00000000 08:02 901194 /usr/lib/libxcb.so.1.0.0
+b7cd9000-b7cda000 rwxp 00016000 08:02 901194 /usr/lib/libxcb.so.1.0.0
+b7cda000-b7cdb000 rwxp b7cda000 00:00 0
+b7cdb000-b7cdc000 r-xp 00000000 08:02 901196 /usr/lib/libxcb-xlib.so.0.0.0
+b7cdc000-b7cdd000 rwxp 00000000 08:02 901196 /usr/lib/libxcb-xlib.so.0.0.0
+b7cdd000-b7e26000 r-xp 00000000 08:02 2785863 /lib/tls/i686/cmov/libc-2.7.so
+b7e26000-b7e27000 r-xp 00149000 08:02 2785863 /lib/tls/i686/cmov/libc-2.7.so
+b7e27000-b7e29000 rwxp 0014a000 08:02 2785863 /lib/tls/i686/cmov/libc-2.7.so
+b7e29000-b7e2c000 rwxp b7e29000 00:00 0
+b7e2c000-b7e2e000 r-xp 00000000 08:02 2785869 /lib/tls/i686/cmov/libdl-2.7.so
+b7e2e000-b7e30000 rwxp 00001000 08:02 2785869 /lib/tls/i686/cmov/libdl-2.7.so
+b7e30000-b7e37000 r-xp 00000000 08:02 1085436 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/jli/libjli.so
+b7e37000-b7e39000 rwxp 00006000 08:02 1085436 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/jli/libjli.so
+b7e39000-b7f1d000 r-xp 00000000 08:02 901308 /usr/lib/libX11.so.6.2.0
+b7f1d000-b7f20000 rwxp 000e4000 08:02 901308 /usr/lib/libX11.so.6.2.0
+b7f20000-b7f21000 rwxp b7f20000 00:00 0
+b7f21000-b7f35000 r-xp 00000000 08:02 2786020 /lib/tls/i686/cmov/libpthread-2.7.so
+b7f35000-b7f37000 rwxp 00013000 08:02 2786020 /lib/tls/i686/cmov/libpthread-2.7.so
+b7f37000-b7f3e000 rwxp b7f37000 00:00 0
+b7f3e000-b7f45000 r-xp 00000000 08:02 2785875 /lib/tls/i686/cmov/libnss_compat-2.7.so
+b7f45000-b7f47000 rwxp 00006000 08:02 2785875 /lib/tls/i686/cmov/libnss_compat-2.7.so
+b7f47000-b7f4d000 r-xp 00000000 08:02 1085422 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/native_threads/libhpi.so
+b7f4d000-b7f4e000 rwxp 00006000 08:02 1085422 /usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/native_threads/libhpi.so
+b7f4e000-b7f4f000 rwxp b7f4e000 00:00 0
+b7f4f000-b7f50000 r-xp b7f4f000 00:00 0
+b7f50000-b7f52000 rwxp b7f50000 00:00 0
+b7f52000-b7f53000 r-xp b7f52000 00:00 0 [vdso]
+b7f53000-b7f6d000 r-xp 00000000 08:02 2786582 /lib/ld-2.7.so
+b7f6d000-b7f6f000 rwxp 00019000 08:02 2786582 /lib/ld-2.7.so
+bfaac000-bfac1000 rwxp bffeb000 00:00 0 [stack]
+
+VM Arguments:
+jvm_args: -Dapplication.home=/usr/lib/jvm/java-6-sun-1.6.0.06
+java_command: sun.applet.Main target/test-classes/appletTest.html
+Launcher Type: SUN_STANDARD
+
+Environment Variables:
+JAVA_HOME=/usr/lib/jvm/java-6-sun
+PATH=/home/clemens/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
+LD_LIBRARY_PATH=/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386/client:/usr/lib/jvm/java-6-sun-1.6.0.06/jre/lib/i386:/usr/lib/jvm/java-6-sun-1.6.0.06/jre/../lib/i386
+SHELL=/bin/bash
+DISPLAY=:0
+
+Signal Handlers:
+SIGSEGV: [libjvm.so+0x3be710], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGBUS: [libjvm.so+0x3be710], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGFPE: [libjvm.so+0x30f810], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGPIPE: [libjvm.so+0x30f810], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGXFSZ: [libjvm.so+0x30f810], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGILL: [libjvm.so+0x30f810], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
+SIGUSR2: [libjvm.so+0x311850], sa_mask[0]=0x00000000, sa_flags=0x10000004
+SIGHUP: [libjvm.so+0x3115f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGINT: [libjvm.so+0x3115f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGTERM: [libjvm.so+0x3115f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGQUIT: [libjvm.so+0x3115f0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+
+
+--------------- S Y S T E M ---------------
+
+OS:lenny/sid
+
+uname:Linux 2.6.24-19-generic #1 SMP Fri Jul 11 23:41:49 UTC 2008 i686
+libc:glibc 2.7 NPTL 2.7
+rlimit: STACK 8192k, CORE 0k, NPROC 16381, NOFILE 1024, AS infinity
+load average:0.84 0.39 0.22
+
+CPU:total 2 (1 cores per cpu, 2 threads per core) family 15 model 4 stepping 3, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ht
+
+Memory: 4k page, physical 2075432k(62584k free), swap 1542200k(1502244k free)
+
+vm_info: Java HotSpot(TM) Client VM (10.0-b22) for linux-x86 JRE (1.6.0_06-b02), built on Mar 25 2008 00:39:19 by "java_re" with gcc 3.2.1-7a (J2SE release)
+
+time: Thu Oct 9 12:01:31 2008
+elapsed time: 55 seconds
+
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
index 34dd9bbd..6a781729 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
@@ -16,9 +16,12 @@
*/
package at.gv.egiz.bku.online.applet;
+import java.net.MalformedURLException;
import java.util.Locale;
import java.util.ResourceBundle;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.net.ssl.HttpsURLConnection;
import javax.swing.JApplet;
@@ -27,6 +30,7 @@ import org.apache.commons.logging.LogFactory;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.gui.BKUGUIFactory;
+import java.net.URL;
/**
* Note: all swing code is executed by the event dispatch thread (see
@@ -40,6 +44,8 @@ public class BKUApplet extends JApplet {
public final static String LOGO_URL_KEY = "LogoURL";
public final static String WSDL_URL = "WSDL_URL";
public final static String SESSION_ID = "SessionID";
+ public static final String BACKGROUND_PARAM = "background";
+
protected ResourceBundle resourceBundle;
protected BKUWorker worker;
protected Thread workerThread;
@@ -58,8 +64,17 @@ public class BKUApplet extends JApplet {
} else {
resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE);
}
+ String backgroundString = getMyAppletParameter(BACKGROUND_PARAM);
+ URL background = null;
+ if (backgroundString != null) {
+ try {
+ background = new URL(backgroundString);
+ } catch (MalformedURLException ex) {
+ log.warn(ex.getMessage() + ", using default background");
+ }
+ }
BKUGUIFacade gui = BKUGUIFactory.createGUI();
- gui.init(getContentPane(), localeString);
+ gui.init(getContentPane(), localeString, background);
worker = new BKUWorker(gui, this, resourceBundle);
}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
index 636a9fef..53ec1088 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
@@ -36,6 +36,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
import java.text.MessageFormat;
import java.util.List;
import java.util.Locale;
@@ -127,7 +128,7 @@ public class BKUGUI implements BKUGUIFacade {
* @param localeString may be null
*/
@Override
- public void init(final Container contentPane, String localeString) {
+ public void init(final Container contentPane, String localeString, final URL background) {
if (localeString != null) {
messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString));
@@ -149,7 +150,7 @@ public class BKUGUI implements BKUGUIFacade {
log.debug("initializing gui");
// initIconPanel();
- initContentPanel();
+ initContentPanel(background);
GroupLayout layout = new GroupLayout(contentPane);
contentPane.setLayout(layout);
@@ -189,7 +190,7 @@ public class BKUGUI implements BKUGUIFacade {
// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //);
// }
- protected void initContentPanel() {
+ protected void initContentPanel(URL background) {
contentPanel = new JPanel();
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index 32eb4c3e..4925e7fa 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -20,6 +20,7 @@ import at.gv.egiz.stal.HashDataInput;
import at.gv.egiz.smcc.PINSpec;
import java.awt.Container;
import java.awt.event.ActionListener;
+import java.net.URL;
import java.util.List;
public interface BKUGUIFacade {
@@ -32,7 +33,7 @@ public interface BKUGUIFacade {
public static final String ERR_WRITE_HASHDATA = "error.write.hashdata";
public static final String ERR_INVALID_HASH = "error.invalid.hash";
- public void init(Container contentPane, String localeString);
+ public void init(Container contentPane, String localeString, URL background);
public void showWelcomeDialog();
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java
new file mode 100644
index 00000000..e9c270ce
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java
@@ -0,0 +1,37 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package at.gv.egiz.bku.gui;
+
+import java.awt.Graphics;
+import java.awt.Image;
+import java.net.URL;
+import javax.swing.ImageIcon;
+import javax.swing.JPanel;
+
+/**
+ *
+ * @author clemens
+ */
+public class ImagePanel extends JPanel {
+
+ protected Image backgroundImg;
+
+ public ImagePanel(URL background) {
+ this(new ImageIcon(background).getImage());
+ }
+
+ public ImagePanel(Image img) {
+ this.backgroundImg = img;
+ this.setOpaque(false);
+ }
+
+ @Override
+ public void paintComponent(Graphics g) {
+ super.paintComponent(g);
+ g.drawImage(backgroundImg, 0, this.getHeight() - backgroundImg.getHeight(null), null);
+ }
+
+}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
index b7d86d05..8e32d67e 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
@@ -36,6 +36,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
import java.text.MessageFormat;
import java.util.List;
import java.util.Locale;
@@ -53,6 +54,7 @@ import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.LayoutStyle;
import javax.swing.SwingUtilities;
+import javax.swing.border.TitledBorder;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
import org.apache.commons.logging.Log;
@@ -66,7 +68,7 @@ public class SimpleGUI implements BKUGUIFacade {
private static final Log log = LogFactory.getLog(SimpleGUI.class);
public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages";
- public static final String LOGO_RESOURCE = "/images/logo.png";
+ public static final String DEFAULT_BACKGROUND = "/images/mocca_default.png"; //logo.png";
public static final String HASHDATA_FONT = "Monospaced";
public static final Color ERROR_COLOR = Color.RED;
public static final Color HYPERLINK_COLOR = Color.BLUE;
@@ -121,13 +123,13 @@ public class SimpleGUI implements BKUGUIFacade {
protected int buttonSize;
private static final int CHECKBOX_WIDTH = new JCheckBox().getPreferredSize().width;
-
+
/**
* @param contentPane
* @param localeString may be null
*/
@Override
- public void init(final Container contentPane, String localeString) {
+ public void init(final Container contentPane, String localeString, final URL background) {
if (localeString != null) {
messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString));
@@ -149,7 +151,7 @@ public class SimpleGUI implements BKUGUIFacade {
log.debug("initializing gui");
// initIconPanel();
- initContentPanel();
+ initContentPanel(background);
GroupLayout layout = new GroupLayout(contentPane);
contentPane.setLayout(layout);
@@ -189,13 +191,20 @@ public class SimpleGUI implements BKUGUIFacade {
// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //);
// }
- protected void initContentPanel() {
+ protected void initContentPanel(URL background) {
- contentPanel = new JPanel();
+ if (background == null) {
+ background = this.getClass().getResource(DEFAULT_BACKGROUND);
+ }
+ contentPanel = new ImagePanel(background);
+// contentPanel.setBorder(new TitledBorder("content"));
+
// headerPanel = new JPanel();
mainPanel = new JPanel();
- buttonPanel = new JPanel();
+ mainPanel.setOpaque(false);
+ buttonPanel = new JPanel(); // new ImagePanel(LOGO_RESOURCE); //new JPanel();
+ buttonPanel.setOpaque(false);
// headerPanel.setBorder(new TitledBorder("header"));
// mainPanel.setBorder(new TitledBorder("main"));
@@ -487,13 +496,14 @@ public class SimpleGUI implements BKUGUIFacade {
// cancelButton.addActionListener(cancelListener);
JButton okButton = new JButton();
+ okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD));
okButton.setText(messages.getString(BUTTON_OK));
okButton.setEnabled(false);
okButton.setActionCommand(okCommand);
okButton.addActionListener(okListener);
JLabel cardPinLabel = new JLabel();
- cardPinLabel.setFont(cardPinLabel.getFont().deriveFont(cardPinLabel.getFont().getStyle() | java.awt.Font.BOLD));
+ cardPinLabel.setFont(cardPinLabel.getFont().deriveFont(cardPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
String pinLabel = messages.getString(LABEL_PIN);
cardPinLabel.setText(MessageFormat.format(pinLabel, new Object[]{pinSpec.getLocalizedName()}));
@@ -513,8 +523,8 @@ public class SimpleGUI implements BKUGUIFacade {
});
JLabel infoLabel = new JLabel();
+ infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD, infoLabel.getFont().getSize()-2));
if (numRetries < 0) {
- infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
String pinsizePattern = messages.getString(LABEL_PINSIZE);
String pinSize = String.valueOf(pinSpec.getMinLength());
if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
@@ -658,13 +668,14 @@ public class SimpleGUI implements BKUGUIFacade {
// cancelButton.addActionListener(cancelListener);
JButton signButton = new JButton();
+ signButton.setFont(signButton.getFont().deriveFont(signButton.getFont().getStyle() & ~java.awt.Font.BOLD));
signButton.setText(messages.getString(BUTTON_SIGN));
signButton.setEnabled(false);
signButton.setActionCommand(signCommand);
signButton.addActionListener(signListener);
JLabel signPinLabel = new JLabel();
- signPinLabel.setFont(signPinLabel.getFont().deriveFont(signPinLabel.getFont().getStyle() | java.awt.Font.BOLD));
+ signPinLabel.setFont(signPinLabel.getFont().deriveFont(signPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
String pinLabel = messages.getString(LABEL_PIN);
signPinLabel.setText(MessageFormat.format(pinLabel, new Object[]{pinSpec.getLocalizedName()}));
@@ -684,7 +695,7 @@ public class SimpleGUI implements BKUGUIFacade {
//pinsize or error label
JLabel infoLabel = new JLabel();
- infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD, infoLabel.getFont().getSize()-2));
if (numRetries < 0) {
String pinsizePattern = messages.getString(LABEL_PINSIZE);
String pinSize = String.valueOf(pinSpec.getMinLength());
@@ -721,7 +732,7 @@ public class SimpleGUI implements BKUGUIFacade {
.addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
- .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(infoLabel));
mainPanelLayout.setVerticalGroup(
@@ -847,6 +858,7 @@ public class SimpleGUI implements BKUGUIFacade {
.addComponent(errorMsgLabel));
JButton okButton = new JButton();
+ okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD));
okButton.setText(messages.getString(BUTTON_OK));
okButton.setActionCommand(okCommand);
okButton.addActionListener(okListener);
@@ -1062,6 +1074,7 @@ public class SimpleGUI implements BKUGUIFacade {
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addComponent(refIdLabel).addGap(refIdLabel.getFont().getSize()).addComponent(hashDataScrollPane).addGap(refIdLabel.getFont().getSize())));
JButton backButton = new JButton();
+ backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD));
backButton.setText(messages.getString(BUTTON_BACK));
backButton.setActionCommand(cancelCommand);
backButton.addActionListener(cancelListener);
@@ -1215,6 +1228,7 @@ public class SimpleGUI implements BKUGUIFacade {
JButton backButton = new JButton();
+ backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD));
backButton.setText(messages.getString(BUTTON_BACK));
backButton.setActionCommand(cancelCommand);
backButton.addActionListener(cancelListener);
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index a2b5e0df..abed420f 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -34,7 +34,7 @@ message.hashdatalist={0} Signaturdatenobjekte:
message.retries=Noch {0} Versuch(e)
message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?
label.pin={0}:
-label.pinsize=({0} stellig)
+label.pinsize={0} stellig
button.ok=OK
button.cancel=Abbrechen
button.back=Zur\u00FCck
diff --git a/BKUCommonGUI/src/main/resources/images/mocca.png b/BKUCommonGUI/src/main/resources/images/mocca.png
new file mode 100644
index 00000000..881a65c1
Binary files /dev/null and b/BKUCommonGUI/src/main/resources/images/mocca.png differ
diff --git a/BKUCommonGUI/src/main/resources/images/mocca_default.png b/BKUCommonGUI/src/main/resources/images/mocca_default.png
new file mode 100644
index 00000000..349d9ff0
Binary files /dev/null and b/BKUCommonGUI/src/main/resources/images/mocca_default.png differ
diff --git a/BKUCommonGUI/src/main/resources/images/mocca_tiny.png b/BKUCommonGUI/src/main/resources/images/mocca_tiny.png
new file mode 100644
index 00000000..1f125d9b
Binary files /dev/null and b/BKUCommonGUI/src/main/resources/images/mocca_tiny.png differ
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
index 5f1bc8b2..308be642 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
@@ -40,7 +40,7 @@ public class BKUGUITest {
BKUGUI gui = new BKUGUI();
Container contentPane = testFrame.getContentPane();
contentPane.setPreferredSize(new Dimension(380, 150));
- gui.init(contentPane, null);
+ gui.init(contentPane, null, null);
BKUGUIWorker worker = new BKUGUIWorker();
worker.init(gui);
testFrame.pack();
diff --git a/BKUOnline/src/main/webapp/META-INF/context.xml b/BKUOnline/src/main/webapp/META-INF/context.xml
index 3568c9ec..cd11ce8e 100644
--- a/BKUOnline/src/main/webapp/META-INF/context.xml
+++ b/BKUOnline/src/main/webapp/META-INF/context.xml
@@ -16,3 +16,4 @@
limitations under the License.
-->
+
diff --git a/BKUOnline/src/main/webapp/appletPage.jsp b/BKUOnline/src/main/webapp/appletPage.jsp
index 59dc2ad5..11f46dca 100644
--- a/BKUOnline/src/main/webapp/appletPage.jsp
+++ b/BKUOnline/src/main/webapp/appletPage.jsp
@@ -42,7 +42,7 @@
height :<%= height %>
};
var parameters = {
- background : <%= backgroundImg %>,
+ background : '<%= backgroundImg %>',
WSDL_URL :'../stal?wsdl',
SessionID : '<%= session.getId() %>',
redirectURL : '../bkuResult'
diff --git a/BKUOnline/src/main/webapp/index.html b/BKUOnline/src/main/webapp/index.html
index bf8b3ae0..8f1a338e 100644
--- a/BKUOnline/src/main/webapp/index.html
+++ b/BKUOnline/src/main/webapp/index.html
@@ -49,8 +49,6 @@
TestRequest
Security Layer Request
-FinanzOnline
-FinanzOnline Demo Integration
STAL Service
STAL Service Endpoint Information
--
cgit v1.2.3
From 8479ef50c84e8998f7909074df6a23c2ff0aa5b0 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Fri, 31 Oct 2008 12:33:18 +0000
Subject: Help Icon
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@132 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
BKUApplet/nb-configuration.xml | 6 ++++++
.../applet/ExternalDisplaySignRequestHandler.java | 16 ++++++++++++++--
.../gv/egiz/bku/online/applet/ExternalHelpListener.java | 17 +++++++++++++++--
.../bku/online/applet/InternalSSLSocketFactory.java | 4 ----
.../bku/online/applet/WebServiceSignRequestHandler.java | 1 +
.../src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 1 +
.../src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java | 1 +
.../java/at/gv/egiz/bku/gui/HashDataTableModel.java | 1 +
.../main/java/at/gv/egiz/bku/gui/HelpMouseListener.java | 17 +++++++++++++++++
.../src/main/java/at/gv/egiz/bku/gui/ImagePanel.java | 16 ++++++++++++++--
.../src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 5 +----
.../src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 2 +-
.../java/at/gv/egiz/bku/local/stal/BKUGuiProxy.java | 4 ++--
.../java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 2 +-
14 files changed, 75 insertions(+), 18 deletions(-)
create mode 100644 BKUApplet/nb-configuration.xml
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUApplet/nb-configuration.xml b/BKUApplet/nb-configuration.xml
new file mode 100644
index 00000000..352a03be
--- /dev/null
+++ b/BKUApplet/nb-configuration.xml
@@ -0,0 +1,6 @@
+
+
+
+ bka
+
+
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java
index 2ac1bc62..2c9fde71 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java
@@ -1,6 +1,18 @@
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * 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.online.applet;
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java
index 4d6d5851..f92a6963 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java
@@ -1,7 +1,20 @@
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * 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.online.applet;
import java.applet.AppletContext;
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java
index fa3587e4..c3417d63 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/InternalSSLSocketFactory.java
@@ -14,10 +14,6 @@
* 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.online.applet;
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java
index b417fd33..ddbe76bf 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package at.gv.egiz.bku.online.applet;
import java.security.DigestException;
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index 6c157e76..872f1874 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package at.gv.egiz.bku.gui;
import at.gv.egiz.stal.HashDataInput;
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java
index 4a338f23..87676026 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package at.gv.egiz.bku.gui;
public class BKUGUIFactory {
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
index 1a833f48..aea85523 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
@@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package at.gv.egiz.bku.gui;
import at.gv.egiz.stal.HashDataInput;
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java
index 6d814f01..531884d1 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java
@@ -1,3 +1,20 @@
+/*
+ * 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.ActionEvent;
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java
index e9c270ce..1185cf53 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java
@@ -1,6 +1,18 @@
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * 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;
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
index 29913d2a..195db27a 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
@@ -14,10 +14,7 @@
* 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;
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
index 308be642..c32a237a 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
@@ -40,7 +40,7 @@ public class BKUGUITest {
BKUGUI gui = new BKUGUI();
Container contentPane = testFrame.getContentPane();
contentPane.setPreferredSize(new Dimension(380, 150));
- gui.init(contentPane, null, null);
+ gui.init(contentPane, null, null, null);
BKUGUIWorker worker = new BKUGUIWorker();
worker.init(gui);
testFrame.pack();
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
index d12be9ac..8a850549 100644
--- 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
@@ -37,8 +37,8 @@ public class BKUGuiProxy implements BKUGUIFacade {
}
@Override
- public void init(Container contentPane, String localeString, URL bgImage) {
- delegate.init(contentPane, localeString, bgImage);
+ public void init(Container contentPane, String localeString, URL bgImage, ActionListener helpListener) {
+ delegate.init(contentPane, localeString, bgImage, helpListener);
}
@Override
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java
index e1d434e3..df5c2b28 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java
@@ -48,7 +48,7 @@ public class SMCCSTALFactory implements STALFactory {
}
dialog = new JDialog();
BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI);
- gui.init(dialog.getContentPane(), locale.toString(), null);
+ gui.init(dialog.getContentPane(), locale.toString(), null, null);
stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog, resourceBundle);
dialog.setPreferredSize(new Dimension(400, 200));
dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
--
cgit v1.2.3
From 9662ac90b6aa84bc54543d3c8670ba6c8e42bbac Mon Sep 17 00:00:00 2001
From: clemenso
Date: Thu, 13 Nov 2008 18:24:57 +0000
Subject: FRAME HashDataDisplay FRAME Help
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@165 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../gv/egiz/bku/online/applet/AppletBKUWorker.java | 6 +-
.../bku/online/applet/AppletHashDataDisplay.java | 217 ++++++++-----
.../egiz/bku/online/applet/AppletHelpListener.java | 45 ---
.../at/gv/egiz/bku/online/applet/BKUApplet.java | 6 +-
.../bku/online/applet/BrowserHelpListener.java | 45 +++
.../bku/online/applet/DefaultHelpListener.java | 77 +++++
.../bku/online/applet/JDialogHashDataDisplay.java | 221 -------------
.../at/gv/egiz/bku/gui/AbstractHelpListener.java | 41 ++-
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 219 +++++++------
.../at/gv/egiz/bku/gui/HashDataTableModel.java | 10 +-
.../java/at/gv/egiz/bku/gui/HashDataViewer.java | 260 ---------------
.../java/at/gv/egiz/bku/gui/HyperLinkRenderer.java | 47 +++
.../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 35 +-
.../gv/egiz/bku/gui/SimpleHashDataTableModel.java | 60 ++++
.../main/java/at/gv/egiz/bku/gui/ViewerDialog.java | 354 +++++++++++++++++++++
.../at/gv/egiz/bku/gui/Messages.properties | 20 +-
.../at/gv/egiz/bku/gui/Messages_en.properties | 17 +-
BKUCommonGUI/src/main/resources/images/help.png | Bin 746 -> 303 bytes
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 2 +-
.../gv/egiz/stal/service/impl/STALServiceImpl.java | 8 +-
.../at/gv/egiz/bku/online/conf/SSLConfigTest.java | 3 +-
STALService/pom.xml | 4 +-
.../at/gv/egiz/stal/util/HashDataInputProxy.java | 67 ----
.../gv/egiz/bku/smccstal/HashDataInputDisplay.java | 20 +-
.../gv/egiz/bku/smccstal/SignRequestHandler.java | 16 +-
25 files changed, 961 insertions(+), 839 deletions(-)
delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java
create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BrowserHelpListener.java
create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/DefaultHelpListener.java
delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/JDialogHashDataDisplay.java
delete mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperLinkRenderer.java
create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleHashDataTableModel.java
create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerDialog.java
delete mode 100644 STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
index 8e88c012..db88c037 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
@@ -195,7 +195,8 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable {
String hashDataDisplayStyle = params.getAppletParameter(BKUApplet.HASHDATA_DISPLAY);
if (BKUApplet.HASHDATA_DISPLAY_INTERNAL.equals(hashDataDisplayStyle)) {
log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL);
- addRequestHandler(SignRequest.class, new AppletHashDataDisplay(stalPort, sessionId));
+ AppletHashDataDisplay handler = new AppletHashDataDisplay(stalPort, sessionId, AppletHashDataDisplay.DISPLAY.applet);
+ addRequestHandler(SignRequest.class, handler);
} else if (BKUApplet.HASHDATA_DISPLAY_BROWSER.equals(hashDataDisplayStyle)) {
URL hashDataURL = params.getURLParameter(BKUApplet.HASHDATA_URL, sessionId);
log.debug("register SignRequestHandler for HashDataURL " + hashDataURL);
@@ -203,7 +204,8 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable {
} else {
//BKUApplet.HASHDATA_DISPLAY_FRAME
log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL);
- addRequestHandler(SignRequest.class, new JDialogHashDataDisplay(stalPort, sessionId, new Dimension(400, 300), locale));
+ AppletHashDataDisplay handler = new AppletHashDataDisplay(stalPort, sessionId, AppletHashDataDisplay.DISPLAY.frame);
+ addRequestHandler(SignRequest.class, handler);
}
}
}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java
index b77485d9..29a60f1d 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java
@@ -14,9 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package at.gv.egiz.bku.online.applet;
+import at.gv.egiz.bku.gui.BKUGUIFacade;
import java.security.DigestException;
import java.security.MessageDigest;
import java.util.ArrayList;
@@ -30,39 +30,69 @@ import org.apache.commons.logging.LogFactory;
import at.gv.egiz.bku.smccstal.SignRequestHandler;
import at.gv.egiz.stal.HashDataInput;
import at.gv.egiz.stal.impl.ByteArrayHashDataInput;
+import at.gv.egiz.stal.service.GetHashDataInputFault;
import at.gv.egiz.stal.service.STALPortType;
import at.gv.egiz.stal.service.types.GetHashDataInputResponseType;
import at.gv.egiz.stal.service.types.GetHashDataInputType;
import at.gv.egiz.stal.signedinfo.DigestMethodType;
import at.gv.egiz.stal.signedinfo.ReferenceType;
+import java.security.NoSuchAlgorithmException;
/**
- * A SignRequesthandler displaying hashdata inputs in the applet
- * (only plaintext data is displayed, other hashdata inputs may be saved to disk).
+ * A SignRequesthandler that obtains hashdata inputs from a STAL webservice and
+ * displays these either within the applet or in a separate frame.
+ * The internal viewer displays plaintext data only, other mimetypes can be saved to disk.
+ * The standalone (frame) viewer displays all mimetypes.
+ *
+ * (This class depends on STALService and therefore is not part of BKUCommonGUI.)
*
* @author Clemens Orthacker
*/
public class AppletHashDataDisplay extends SignRequestHandler {
+ public static enum DISPLAY {
+ applet, frame
+ }
private static final Log log = LogFactory.getLog(AppletHashDataDisplay.class);
- STALPortType stalPort;
- String sessId;
+ protected STALPortType stalPort;
+ protected String sessId;
+ protected DISPLAY display;
- public AppletHashDataDisplay(STALPortType stalPort, String sessId) {
+ public AppletHashDataDisplay(STALPortType stalPort, String sessId, DISPLAY display) {
if (stalPort == null || sessId == null) {
throw new NullPointerException("STAL port must not be null");
}
this.sessId = sessId;
this.stalPort = stalPort;
+ this.display = display;
}
@Override
- public void displayHashDataInputs(List signedReferences) throws Exception {
-
+ public void displayHashDataInputs(List signedReferences) throws DigestException, Exception {
+
+ List hdi = getHashDataInput(signedReferences);
+ List verifiedHashDataInputs = verifyHashDataInput(signedReferences, hdi);
+
+ if (verifiedHashDataInputs.size() > 1) {
+ gui.showHashDataInputDialog(verifiedHashDataInputs, false, this, "ok");
+ } else if (verifiedHashDataInputs.size() == 1) {
+ gui.showHashDataInputDialog(verifiedHashDataInputs, display==DISPLAY.frame, this, "ok");
+ } else {
+ throw new Exception("No signature data (apart from any QualifyingProperties or a Manifest)");
+ }
+ }
+
+ /**
+ * Get all hashdata inputs that contain an ID attribute but no Type attribute.
+ * @param signedReferences
+ * @return
+ * @throws at.gv.egiz.stal.service.GetHashDataInputFault
+ */
+ private List getHashDataInput(List signedReferences) throws GetHashDataInputFault, Exception {
GetHashDataInputType request = new GetHashDataInputType();
request.setSessionId(sessId);
- HashMap idSignedRefMap = new HashMap();
+// HashMap idSignedRefMap = new HashMap();
for (ReferenceType signedRef : signedReferences) {
//don't get Manifest, QualifyingProperties, ...
if (signedRef.getType() == null) {
@@ -71,97 +101,116 @@ public class AppletHashDataDisplay extends SignRequestHandler {
if (log.isTraceEnabled()) {
log.trace("requesting hashdata input for reference " + signedRefId);
}
- idSignedRefMap.put(signedRefId, signedRef);
+// idSignedRefMap.put(signedRefId, signedRef);
GetHashDataInputType.Reference ref = new GetHashDataInputType.Reference();
ref.setID(signedRefId);
request.getReference().add(ref);
} else {
- throw new Exception("Cannot resolve HashDataInput for reference without Id attribute");
+ throw new Exception("Cannot resolve signature data for dsig:Reference without Id attribute");
}
}
}
if (log.isDebugEnabled()) {
- log.debug("Calling GetHashDataInput for " + request.getReference().size() + " references in session " + sessId);
+ log.debug("WebService call GetHashDataInput for " + request.getReference().size() + " references in session " + sessId);
}
GetHashDataInputResponseType response = stalPort.getHashDataInput(request);
- ArrayList hashDataInputs = new ArrayList();
-
- //hashdata inputs returned from service
- HashMap idRefMap = new HashMap();
- for (GetHashDataInputResponseType.Reference reference : response.getReference()) {
- String id = reference.getID();
- byte[] hdi = reference.getValue();
- if (hdi == null) {
- throw new Exception("Did not receive hashdata input for reference " + id);
+ return response.getReference();
+ }
+
+ /**
+ * Verifies all signed references and returns STAL HashDataInputs
+ * @param signedReferences
+ * @param hashDataInputs
+ * @return
+ * @throws java.security.DigestException
+ * @throws java.security.NoSuchAlgorithmException
+ * @throws Exception if no hashdata input is provided for a signed reference
+ */
+ private List verifyHashDataInput(List signedReferences, List hashDataInputs) throws DigestException, NoSuchAlgorithmException, Exception {
+
+ ArrayList verifiedHashDataInputs = new ArrayList();
+
+ for (ReferenceType signedRef : signedReferences) {
+ if (signedRef.getType() == null) {
+ log.info("Verifying digest for signed reference " + signedRef.getId());
+
+ String signedRefId = signedRef.getId();
+ byte[] signedDigest = signedRef.getDigestValue();
+ String signedDigestAlg = null;
+ if (signedRef.getDigestMethod() != null) {
+ signedDigestAlg = signedRef.getDigestMethod().getAlgorithm();
+ } else {
+ throw new NoSuchAlgorithmException("Failed to verify digest value for reference " + signedRefId + ": no digest algorithm");
+ }
+
+ // usually, there is just one item here
+ GetHashDataInputResponseType.Reference hashDataInput = null;
+ for (GetHashDataInputResponseType.Reference hdi : hashDataInputs) {
+ if (signedRefId.equals(hdi.getID())) {
+ hashDataInput = hdi;
+ break;
+ }
+ }
+ if (hashDataInput == null) {
+ throw new Exception("No hashdata input for reference " + signedRefId + " returned by service");
+ }
+
+ byte[] hdi = hashDataInput.getValue();
+ String mimeType = hashDataInput.getMimeType();
+ String encoding = hashDataInput.getEncoding();
+
+ if (hdi == null) {
+ throw new Exception("No hashdata input for reference " + signedRefId + " provided by service");
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("Got HashDataInput " + signedRefId + " (" + mimeType + ";" + encoding + ")");
+ }
+
+ byte[] hashDataInputDigest = digest(hdi, signedDigestAlg);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Comparing digest values... ");
+ }
+// log.warn("***************** DISABLED HASHDATA VERIFICATION");
+ if (!Arrays.equals(hashDataInputDigest, signedDigest)) {
+ log.error("Bad digest value for reference " + signedRefId);
+ throw new DigestException("Bad digest value for reference " + signedRefId);
+ }
+
+ verifiedHashDataInputs.add(new ByteArrayHashDataInput(hdi, signedRefId, mimeType, encoding));
}
- idRefMap.put(id, reference);
}
- for (String signedRefId : idSignedRefMap.keySet()) {
- log.info("validating hashdata input for reference " + signedRefId);
-
- GetHashDataInputResponseType.Reference reference = idRefMap.get(signedRefId);
- if (reference == null) {
- throw new Exception("No hashdata input for reference " + signedRefId + " returned by service");
- }
-
-// }
-//
-// for (GetHashDataInputResponseType.Reference reference : response.getReference()) {
-//
-// String id = reference.getID();
- byte[] hdi = reference.getValue();
- String mimeType = reference.getMimeType();
- String encoding = reference.getEncoding();
-
- if (hdi == null) {
- throw new Exception("No hashdata input provided for reference " + signedRefId);
- }
- if (log.isDebugEnabled()) {
- log.debug("Got HashDataInput " + signedRefId + " (" + mimeType + ";" + encoding + ")");
- }
+ return verifiedHashDataInputs;
+ }
- ReferenceType dsigRef = idSignedRefMap.get(signedRefId);
- DigestMethodType dm = dsigRef.getDigestMethod();
-
- if (dm == null) {
- throw new Exception("Failed to verify digest value for reference " + signedRefId + ": no digest algorithm");
- }
- String mdAlg = dm.getAlgorithm();
- if ("http://www.w3.org/2000/09/xmldsig#sha1".equals(mdAlg))
- mdAlg = "SHA-1";
- else if ("http://www.w3.org/2001/04/xmlenc#sha256".equals(mdAlg))
- mdAlg = "SHA-256";
- else if ("http://www.w3.org/2001/04/xmlenc#sha224 ".equals(mdAlg))
- mdAlg = "SHA-224";
- else if ("http://www.w3.org/2001/04/xmldsig-more#sha224 ".equals(mdAlg))
- mdAlg = "SHA-224";
- else if ("http://www.w3.org/2001/04/xmldsig-more#sha384".equals(mdAlg))
- mdAlg = "SHA-384";
- else if ("http://www.w3.org/2001/04/xmlenc#sha512".equals(mdAlg))
- mdAlg = "SHA-512";
- else if ("http://www.w3.org/2001/04/xmldsig-more#md2 ".equals(mdAlg))
- mdAlg = "MD2";
- else if ("http://www.w3.org/2001/04/xmldsig-more#md5".equals(mdAlg))
- mdAlg = "MD5";
- else if ("http://www.w3.org/2001/04/xmlenc#ripemd160 ".equals(mdAlg))
- mdAlg = "RipeMD-160";
- else {
- throw new Exception("Failed to verify digest value for reference " + signedRefId + ": unsupported digest algorithm " + mdAlg);
- }
- MessageDigest md = MessageDigest.getInstance(mdAlg);
- byte[] hdiDigest = md.digest(hdi);
- if (log.isDebugEnabled())
- log.debug("Comparing digest values... ");
- if (!Arrays.equals(hdiDigest, dsigRef.getDigestValue())) {
- log.error("digest values differ: " + new String(hdiDigest) + ", " + new String(dsigRef.getDigestValue()));
- throw new DigestException("Bad digest value for reference " + signedRefId + ": " + new String(dsigRef.getDigestValue()));
- }
- hashDataInputs.add(new ByteArrayHashDataInput(hdi, signedRefId, mimeType, encoding));
+ //TODO
+ private byte[] digest(byte[] hashDataInput, String mdAlg) throws NoSuchAlgorithmException {
+ if ("http://www.w3.org/2000/09/xmldsig#sha1".equals(mdAlg)) {
+ mdAlg = "SHA-1";
+ } else if ("http://www.w3.org/2001/04/xmlenc#sha256".equals(mdAlg)) {
+ mdAlg = "SHA-256";
+ } else if ("http://www.w3.org/2001/04/xmlenc#sha224".equals(mdAlg)) {
+ mdAlg = "SHA-224";
+ } else if ("http://www.w3.org/2001/04/xmldsig-more#sha224".equals(mdAlg)) {
+ mdAlg = "SHA-224";
+ } else if ("http://www.w3.org/2001/04/xmldsig-more#sha384".equals(mdAlg)) {
+ mdAlg = "SHA-384";
+ } else if ("http://www.w3.org/2001/04/xmlenc#sha512".equals(mdAlg)) {
+ mdAlg = "SHA-512";
+ } else if ("http://www.w3.org/2001/04/xmldsig-more#md2".equals(mdAlg)) {
+ mdAlg = "MD2";
+ } else if ("http://www.w3.org/2001/04/xmldsig-more#md5".equals(mdAlg)) {
+ mdAlg = "MD5";
+ } else if ("http://www.w3.org/2001/04/xmlenc#ripemd160".equals(mdAlg)) {
+ mdAlg = "RipeMD-160";
+ } else {
+ throw new NoSuchAlgorithmException("Failed to verify digest value: unsupported digest algorithm " + mdAlg);
}
-
- gui.showHashDataInputDialog(hashDataInputs, false, this, "ok");
+
+ MessageDigest md = MessageDigest.getInstance(mdAlg);
+ return md.digest(hashDataInput);
}
}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java
deleted file mode 100644
index 5d199872..00000000
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java
+++ /dev/null
@@ -1,45 +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.online.applet;
-
-import at.gv.egiz.bku.gui.AbstractHelpListener;
-import java.applet.AppletContext;
-import java.net.URL;
-import java.util.Locale;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class AppletHelpListener extends AbstractHelpListener {
-
- protected AppletContext ctx;
-
- public AppletHelpListener(AppletContext ctx, URL helpURL, Locale locale) {
- super(helpURL, locale);
- if (ctx == null) {
- throw new RuntimeException("no applet context provided");
- }
- this.ctx = ctx;
- }
-
- @Override
- public void showDocument(URL helpDocument) throws Exception {
- ctx.showDocument(helpDocument, "_blank");
- }
-}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
index 9d640dee..b4407b22 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
@@ -16,6 +16,7 @@
*/
package at.gv.egiz.bku.online.applet;
+import at.gv.egiz.bku.gui.AbstractHelpListener;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Locale;
@@ -85,10 +86,11 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
String locale = getAppletParameter(LOCALE_PARAM_KEY);
String guiStyle = getAppletParameter(GUI_STYLE);
URL backgroundImgURL = null;
- AppletHelpListener helpListener = null;
+ AbstractHelpListener helpListener = null;
try {
URL helpURL = getURLParameter(HELP_URL); //, getAppletParameter(SESSION_ID));
- helpListener = new AppletHelpListener(getAppletContext(), helpURL, getLocale());
+// helpListener = new BrowserHelpListener(getAppletContext(), helpURL, getLocale());
+ helpListener = new DefaultHelpListener(helpURL, getLocale());
} catch (MalformedURLException ex) {
log.warn("failed to load help URL, disabling help: " + ex.getMessage());
}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BrowserHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BrowserHelpListener.java
new file mode 100644
index 00000000..265acca0
--- /dev/null
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BrowserHelpListener.java
@@ -0,0 +1,45 @@
+/*
+ * 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.online.applet;
+
+import at.gv.egiz.bku.gui.AbstractHelpListener;
+import java.applet.AppletContext;
+import java.net.URL;
+import java.util.Locale;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class BrowserHelpListener extends AbstractHelpListener {
+
+ protected AppletContext ctx;
+
+ public BrowserHelpListener(AppletContext ctx, URL helpURL, Locale locale) {
+ super(helpURL, locale);
+ if (ctx == null) {
+ throw new RuntimeException("no applet context provided");
+ }
+ this.ctx = ctx;
+ }
+
+ @Override
+ public void showDocument(URL helpDocument, String helpTopic) throws Exception {
+ ctx.showDocument(helpDocument, "_blank");
+ }
+}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/DefaultHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/DefaultHelpListener.java
new file mode 100644
index 00000000..9876ef7e
--- /dev/null
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/DefaultHelpListener.java
@@ -0,0 +1,77 @@
+/*
+ * 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.online.applet;
+
+import at.gv.egiz.bku.gui.AbstractHelpListener;
+import at.gv.egiz.bku.gui.ViewerDialog;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.Locale;
+import javax.swing.SwingUtilities;
+
+/**
+ * This class depends on BKU utils, and therefore is not part of BKUCommonGUI
+ *
+ * @author Clemens Orthacker
+ */
+public class DefaultHelpListener extends AbstractHelpListener {
+
+ public DefaultHelpListener(URL helpURL, Locale locale) {
+ super(helpURL, locale);
+ }
+
+ @Override
+ public void showDocument(URL helpURL, final String helpTopic) throws Exception {
+ log.debug("open connection " + helpURL);
+ URLConnection conn = helpURL.openConnection();
+
+ log.debug("show help document " + conn.getContentType()); // + ";" + conn.getContentEncoding());
+
+// Charset cs;
+// if (conn.getContentEncoding() == null) {
+// cs = Charset.forName("UTF-8");
+// } else {
+// try {
+// cs = Charset.forName(conn.getContentEncoding());
+// } catch (Exception ex) {
+// log.debug("charset " + conn.getContentEncoding() + " not supported, assuming UTF-8: " + ex.getMessage());
+// cs = Charset.forName("UTF-8");
+// }
+// }
+
+// InputStreamReader isr = new InputStreamReader(conn.getInputStream(), cs);
+// final Reader content = new BufferedReader(isr);
+ final InputStream content = conn.getInputStream();
+ final String mimeType = conn.getContentType();
+
+ log.debug("schedule help dialog");
+
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+
+ log.debug("show help dialog");
+
+ ViewerDialog.showHelp(null, helpTopic, content, mimeType, messages);
+
+ }
+ });
+// gui.showHelpDialog(helpDocument.getStream(), mimetype, encoding);
+ }
+}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/JDialogHashDataDisplay.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/JDialogHashDataDisplay.java
deleted file mode 100644
index 1f0eda90..00000000
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/JDialogHashDataDisplay.java
+++ /dev/null
@@ -1,221 +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.online.applet;
-
-import at.gv.egiz.bku.smccstal.SignRequestHandler;
-import at.gv.egiz.stal.HashDataInput;
-import at.gv.egiz.stal.impl.ByteArrayHashDataInput;
-import at.gv.egiz.stal.service.GetHashDataInputFault;
-import at.gv.egiz.stal.service.STALPortType;
-import at.gv.egiz.stal.service.types.GetHashDataInputResponseType;
-import at.gv.egiz.stal.service.types.GetHashDataInputType;
-import at.gv.egiz.stal.signedinfo.ReferenceType;
-import java.awt.Dimension;
-import java.security.DigestException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class JDialogHashDataDisplay extends SignRequestHandler {
-
- private static final Log log = LogFactory.getLog(JDialogHashDataDisplay.class);
- protected STALPortType stalPort;
- protected String sessId;
-// protected HashDataViewer viewer;
-
- public JDialogHashDataDisplay(STALPortType stalPort, String sessId, Dimension viewerSize, Locale locale) {
- if (stalPort == null || sessId == null) {
- throw new NullPointerException("STAL port must not be null");
- }
- this.sessId = sessId;
- this.stalPort = stalPort;
-// this.viewer = new HashDataViewer(viewerSize, locale);
- }
-
- @Override
- public void displayHashDataInputs(List signedReferences) throws DigestException, Exception {
-
- List hdi = getHashDataInput(signedReferences);
- final List verifiedHashDataInputs = verifyHashDataInput(signedReferences, hdi);
-
- if (verifiedHashDataInputs.size() > 1) {
- gui.showHashDataInputDialog(verifiedHashDataInputs, false, this, "ok");
- } else if (verifiedHashDataInputs.size() == 1) {
- gui.showHashDataInputDialog(verifiedHashDataInputs, true, this, "ok");
-// SwingUtilities.invokeLater(new Runnable() {
-//
-// @Override
-// public void run() {
-// viewer.displayHashData(verifiedHashDataInputs.get(0));
-// }
-// });
-
- } else {
- log.error("No hashdata input to display");
- }
-
- }
-
- /**
- * Get all hashdata inputs that contain an ID attribute and no Type attribute.
- * @param signedReferences
- * @return
- * @throws at.gv.egiz.stal.service.GetHashDataInputFault
- */
- private List getHashDataInput(List signedReferences) throws GetHashDataInputFault, Exception {
- GetHashDataInputType request = new GetHashDataInputType();
- request.setSessionId(sessId);
-
-// HashMap idSignedRefMap = new HashMap();
- for (ReferenceType signedRef : signedReferences) {
- //don't get Manifest, QualifyingProperties, ...
- if (signedRef.getType() == null) {
- String signedRefId = signedRef.getId();
- if (signedRefId != null) {
- if (log.isTraceEnabled()) {
- log.trace("requesting hashdata input for reference " + signedRefId);
- }
-// idSignedRefMap.put(signedRefId, signedRef);
- GetHashDataInputType.Reference ref = new GetHashDataInputType.Reference();
- ref.setID(signedRefId);
- request.getReference().add(ref);
-
- } else {
- throw new Exception("Cannot resolve HashDataInput for reference without Id attribute");
- }
- }
- }
-
- if (log.isDebugEnabled()) {
- log.debug("WebService call GetHashDataInput for " + request.getReference().size() + " references in session " + sessId);
- }
- GetHashDataInputResponseType response = stalPort.getHashDataInput(request);
- return response.getReference();
- }
-
- /**
- * Verifies all signed references and returns STAL HashDataInputs
- * @param signedReferences
- * @param hashDataInputs
- * @return
- * @throws java.security.DigestException
- * @throws java.security.NoSuchAlgorithmException
- * @throws Exception if no hashdata input is provided for a signed reference
- */
- private List verifyHashDataInput(List signedReferences, List hashDataInputs) throws DigestException, NoSuchAlgorithmException, Exception {
-
- ArrayList verifiedHashDataInputs = new ArrayList();
-
- //hashdata inputs returned from service
-// HashMap idRefMap = new HashMap();
-// for (GetHashDataInputResponseType.Reference hashDataInput : hashDataInputs) {
-// String id = hashDataInput.getID();
-// byte[] hdi = hashDataInput.getValue();
-// if (hdi == null) {
-// throw new Exception("Did not receive hashdata input for reference " + id);
-// }
-// idRefMap.put(id, hashDataInput);
-// }
-
- for (ReferenceType signedRef : signedReferences) {
- if (signedRef.getType() == null) {
- log.info("Verifying digest for signed reference " + signedRef.getId());
-
- String signedRefId = signedRef.getId();
- byte[] signedDigest = signedRef.getDigestValue();
- String signedDigestAlg = null;
- if (signedRef.getDigestMethod() != null) {
- signedDigestAlg = signedRef.getDigestMethod().getAlgorithm();
- } else {
- throw new NoSuchAlgorithmException("Failed to verify digest value for reference " + signedRefId + ": no digest algorithm");
- }
-
- GetHashDataInputResponseType.Reference hashDataInput = null; //idRefMap.get(signedRefId);
- for (GetHashDataInputResponseType.Reference hdi : hashDataInputs) {
- if (signedRefId.equals(hdi.getID())) {
- hashDataInput = hdi;
- }
- }
- if (hashDataInput == null) {
- throw new Exception("No hashdata input for reference " + signedRefId + " returned by service");
- }
-
- byte[] hdi = hashDataInput.getValue();
- String mimeType = hashDataInput.getMimeType();
- String encoding = hashDataInput.getEncoding();
-
- if (hdi == null) {
- throw new Exception("No hashdata input for reference " + signedRefId + " provided by service");
- }
- if (log.isDebugEnabled()) {
- log.debug("Got HashDataInput " + signedRefId + " (" + mimeType + ";" + encoding + ")");
- }
-
- byte[] hashDataInputDigest = digest(hdi, signedDigestAlg);
-
- if (log.isDebugEnabled()) {
- log.debug("Comparing digest values... ");
- }
- log.warn("DISABLED DIGEST VERIFICATION FOR DEBUGGING");
-// if (!Arrays.equals(hashDataInputDigest, signedDigest)) {
-// log.error("Bad digest value for reference " + signedRefId);
-// throw new DigestException("Bad digest value for reference " + signedRefId);
-// }
-
- verifiedHashDataInputs.add(new ByteArrayHashDataInput(hdi, signedRefId, mimeType, encoding));
- }
- }
-
- return verifiedHashDataInputs;
- }
-
- //TODO
- private byte[] digest(byte[] hashDataInput, String mdAlg) throws NoSuchAlgorithmException {
- if ("http://www.w3.org/2000/09/xmldsig#sha1".equals(mdAlg)) {
- mdAlg = "SHA-1";
- } else if ("http://www.w3.org/2001/04/xmlenc#sha256".equals(mdAlg)) {
- mdAlg = "SHA-256";
- } else if ("http://www.w3.org/2001/04/xmlenc#sha224".equals(mdAlg)) {
- mdAlg = "SHA-224";
- } else if ("http://www.w3.org/2001/04/xmldsig-more#sha224".equals(mdAlg)) {
- mdAlg = "SHA-224";
- } else if ("http://www.w3.org/2001/04/xmldsig-more#sha384".equals(mdAlg)) {
- mdAlg = "SHA-384";
- } else if ("http://www.w3.org/2001/04/xmlenc#sha512".equals(mdAlg)) {
- mdAlg = "SHA-512";
- } else if ("http://www.w3.org/2001/04/xmldsig-more#md2 ".equals(mdAlg)) {
- mdAlg = "MD2";
- } else if ("http://www.w3.org/2001/04/xmldsig-more#md5".equals(mdAlg)) {
- mdAlg = "MD5";
- } else if ("http://www.w3.org/2001/04/xmlenc#ripemd160 ".equals(mdAlg)) {
- mdAlg = "RipeMD-160";
- } else {
- throw new NoSuchAlgorithmException("Failed to verify digest value: unsupported digest algorithm " + mdAlg);
- }
-
- MessageDigest md = MessageDigest.getInstance(mdAlg);
- return md.digest(hashDataInput);
- }
-}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java
index a249a376..f46f5227 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package at.gv.egiz.bku.gui;
import java.awt.event.ActionEvent;
@@ -22,19 +21,24 @@ import java.awt.event.ActionListener;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Locale;
+import java.util.ResourceBundle;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
- *
+ * Implement the showDocument(URL) method to provide an actual HelpListener.
+ * This class does not keep a GUI reference and subclasses should not interfere with the GUI.
+ * Therefore, any errors occurring in showDocument() should be handled/displayed within
+ * showDocument() and exceptions thrown from showDocument() are logged, not displayed in the GUI.
+ *
* @author Clemens Orthacker
*/
public abstract class AbstractHelpListener implements ActionListener {
protected final static Log log = LogFactory.getLog(AbstractHelpListener.class);
-// protected String helpURLBase;
protected URL baseURL;
protected Locale locale;
+ protected ResourceBundle messages;
public AbstractHelpListener(URL baseURL, Locale locale) {
if (baseURL == null || "".equals(baseURL)) {
@@ -42,6 +46,11 @@ public abstract class AbstractHelpListener implements ActionListener {
}
this.baseURL = baseURL;
this.locale = locale;
+ if (locale != null) {
+ messages = ResourceBundle.getBundle(BKUGUIFacade.MESSAGES_BUNDLE, locale);
+ } else {
+ messages = ResourceBundle.getBundle(BKUGUIFacade.MESSAGES_BUNDLE);
+ }
}
@Override
@@ -49,30 +58,36 @@ public abstract class AbstractHelpListener implements ActionListener {
log.debug("received help action: " + e.getActionCommand());
URL helpURL = constructHelpURL(baseURL, e.getActionCommand());
try {
- showDocument(helpURL);
+ showDocument(helpURL, e.getActionCommand());
} catch (Exception ex) {
log.error("could not display help document " + helpURL + ": " + ex.getMessage());
}
}
-
- private URL constructHelpURL(URL baseURL, String helpItem) {
+
+ private URL constructHelpURL(URL baseURL, String helpTopic) {
URL helpURL = baseURL;
log.trace("constructing help URL: " + helpURL);
try {
if (locale != null) {
helpURL = new URL(helpURL, locale.toString() + "/");
log.trace("constructing help URL: " + helpURL);
- }
- if (helpItem != null && !"".equals(helpItem)) {
- helpURL = new URL(helpURL, helpItem + ".html");
+ }
+ if (helpTopic != null && !"".equals(helpTopic)) {
+ helpURL = new URL(helpURL, helpTopic + ".html");
log.trace("constructing help URL: " + helpURL);
}
} catch (MalformedURLException ex) {
- log.error("Failed to construct help URL for help item " + helpItem + ": " + ex.getMessage());
+ log.error("Failed to construct help URL for help item " + helpTopic + ": " + ex.getMessage());
}
return helpURL;
}
-
- public abstract void showDocument(URL helpDocument) throws Exception;
-
+
+ /**
+ * Errors from HelpListeners should not (are not) displayed in the applet,
+ * but should rather be in the HelpListener specific way.
+ * Therefore, implementations SHOULD NOT throw exceptions (these are only logged).
+ * @param helpDocument
+ * @throws java.lang.Exception
+ */
+ public abstract void showDocument(URL helpDocument, String helpTopic) throws Exception;
}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index 38638b5d..2daf3300 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -1,20 +1,19 @@
/*
-* 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.
-*/
-
+ * 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.stal.HashDataInput;
@@ -27,7 +26,7 @@ import java.util.List;
import java.util.Locale;
public interface BKUGUIFacade {
-
+
public static final String ERR_UNKNOWN = "error.unknown";
public static final String ERR_SERVICE_UNREACHABLE = "error.ws.unreachable";
public static final String ERR_NO_PCSC = "error.pcsc";
@@ -38,92 +37,108 @@ public interface BKUGUIFacade {
public static final String ERR_INVALID_HASH = "error.invalid.hash";
public static final String ERR_CARD_LOCKED = "error.card.locked";
public static final String ERR_CARD_NOTACTIVATED = "error.card.notactivated";
+ public static final String ERR_VIEWER = "error.viewer";
- public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages";
- public static final String DEFAULT_BACKGROUND = "/images/BackgroundChipperling.png";
- public static final String HELP_IMG = "/images/help.png";
- public static final String HASHDATA_FONT = "Monospaced";
- public static final Color ERROR_COLOR = Color.RED;
- public static final Color HYPERLINK_COLOR = Color.BLUE;
- public static final String TITLE_WELCOME = "title.welcome";
- public static final String TITLE_INSERTCARD = "title.insertcard";
- public static final String TITLE_CARD_NOT_SUPPORTED = "title.cardnotsupported";
- public static final String TITLE_CARDPIN = "title.cardpin";
- public static final String TITLE_SIGN = "title.sign";
- public static final String TITLE_ERROR = "title.error";
- public static final String TITLE_RETRY = "title.retry";
- public static final String TITLE_WAIT = "title.wait";
- public static final String TITLE_HASHDATA = "title.hashdata";
- public static final String WINDOWTITLE_SAVE = "windowtitle.save";
- public static final String WINDOWTITLE_SAVEDIR = "windowtitle.savedir";
- public static final String WINDOWTITLE_OVERWRITE = "windowtitle.overwrite";
- public static final String WINDOWTITLE_VIEWER = "windowtitle.viewer";
- public static final String MESSAGE_WAIT = "message.wait";
- public static final String MESSAGE_INSERTCARD = "message.insertcard";
- public static final String MESSAGE_ENTERPIN = "message.enterpin";
- public static final String MESSAGE_HASHDATALINK = "message.hashdatalink";
- public static final String MESSAGE_HASHDATA = "message.hashdata";
- public static final String MESSAGE_HASHDATALIST = "message.hashdatalist";
- public static final String MESSAGE_RETRIES = "message.retries";
- public static final String MESSAGE_OVERWRITE = "message.overwrite";
- public static final String LABEL_PIN = "label.pin";
- public static final String LABEL_PINSIZE = "label.pinsize";
+ public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages";
+ public static final String DEFAULT_BACKGROUND = "/images/BackgroundChipperling.png";
+ public static final String HELP_IMG = "/images/help.png";
+ public static final String HASHDATA_FONT = "Monospaced";
+ public static final Color ERROR_COLOR = Color.RED;
+ public static final Color HYPERLINK_COLOR = Color.BLUE;
+ public static final String TITLE_WELCOME = "title.welcome";
+ public static final String TITLE_INSERTCARD = "title.insertcard";
+ public static final String TITLE_CARD_NOT_SUPPORTED = "title.cardnotsupported";
+ public static final String TITLE_CARDPIN = "title.cardpin";
+ public static final String TITLE_SIGN = "title.sign";
+ public static final String TITLE_ERROR = "title.error";
+ public static final String TITLE_RETRY = "title.retry";
+ public static final String TITLE_WAIT = "title.wait";
+ public static final String TITLE_HASHDATA = "title.hashdata";
+ public static final String WINDOWTITLE_SAVE = "windowtitle.save";
+ public static final String WINDOWTITLE_SAVEDIR = "windowtitle.savedir";
+ public static final String WINDOWTITLE_OVERWRITE = "windowtitle.overwrite";
+ public static final String WINDOWTITLE_VIEWER = "windowtitle.viewer";
+ public static final String WINDOWTITLE_HELP = "windowtitle.help";
+ public static final String MESSAGE_WAIT = "message.wait";
+ public static final String MESSAGE_INSERTCARD = "message.insertcard";
+ public static final String MESSAGE_ENTERPIN = "message.enterpin";
+ public static final String MESSAGE_HASHDATALINK = "message.hashdatalink";
+ public static final String MESSAGE_HASHDATA = "message.hashdata";
+ public static final String MESSAGE_HASHDATALIST = "message.hashdatalist";
+ public static final String MESSAGE_RETRIES = "message.retries";
+ public static final String MESSAGE_OVERWRITE = "message.overwrite";
+ public static final String MESSAGE_HELP = "message.help";
+ public static final String LABEL_PIN = "label.pin";
+ public static final String LABEL_PINSIZE = "label.pinsize";
// public static final String ERROR_NO_HASHDATA = "error.no.hashdata";
- public static final String HELP_WELCOME = "help.welcome";
- public static final String HELP_WAIT = "help.wait";
- public static final String HELP_CARDNOTSUPPORTED = "help.cardnotsupported";
- public static final String HELP_INSERTCARD = "help.insertcard";
- public static final String HELP_CARDPIN = "help.cardpin";
- public static final String HELP_SIGNPIN = "help.signpin";
- public static final String HELP_RETRY = "help.retry";
- public static final String HELP_HASHDATA = "help.hashdata";
- public static final String HELP_HASHDATALIST = "help.hashdatalist";
- public static final String HELP_HASHDATAVIEWER = "help.hashdataviewer";
-
- public static final String BUTTON_OK = "button.ok";
- public static final String BUTTON_CANCEL = "button.cancel";
- public static final String BUTTON_BACK = "button.back";
- public static final String BUTTON_SIGN = "button.sign";
- public static final String BUTTON_SAVE = "button.save";
- public static final String BUTTON_CLOSE = "button.close";
- public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix";
-
-
- public void init(Container contentPane, Locale locale, URL background, ActionListener helpListener);
-
- /**
- *
- * @return the locale of the message bundle (what if no message bundle could be loaded for the requested locale?)
- */
- public Locale getLocale();
-
- public void showWelcomeDialog();
-
- /**
- *
- * @param waitMessage if null, a simple 'wait' text is displayed
- */
- public void showWaitDialog(String waitMessage);
-
- public void showInsertCardDialog(ActionListener cancelListener, String actionCommand);
-
- public void showCardNotSupportedDialog(ActionListener cancelListener, String actionCommand);
-
- public void showCardPINDialog(PINSpec pinSpec, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand);
-
- public void showCardPINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand);
-
- public void showSignaturePINDialog(PINSpec pinSpec, ActionListener signListener, String signCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand);
-
- public void showSignaturePINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand);
-
- public char[] getPin();
-
- public void showHashDataInputDialog(List signedReferences, boolean standalone, ActionListener okListener, String actionCommand);
-
+ public static final String HELP_WELCOME = "help.welcome";
+ public static final String HELP_WAIT = "help.wait";
+ public static final String HELP_CARDNOTSUPPORTED = "help.cardnotsupported";
+ public static final String HELP_INSERTCARD = "help.insertcard";
+ public static final String HELP_CARDPIN = "help.cardpin";
+ public static final String HELP_SIGNPIN = "help.signpin";
+ public static final String HELP_RETRY = "help.retry";
+ public static final String HELP_HASHDATA = "help.hashdata";
+ public static final String HELP_HASHDATALIST = "help.hashdatalist";
+ public static final String HELP_HASHDATAVIEWER = "help.hashdataviewer";
+ public static final String BUTTON_OK = "button.ok";
+ public static final String BUTTON_CANCEL = "button.cancel";
+ public static final String BUTTON_BACK = "button.back";
+ public static final String BUTTON_SIGN = "button.sign";
+ public static final String BUTTON_SAVE = "button.save";
+ public static final String BUTTON_CLOSE = "button.close";
+ public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix";
+
+ public void init(Container contentPane, Locale locale, URL background, ActionListener helpListener);
+
+ /**
+ *
+ * @return the locale of the message bundle (what if no message bundle could be loaded for the requested locale?)
+ */
+ public Locale getLocale();
+
+ public void showWelcomeDialog();
+
+ /**
+ *
+ * @param waitMessage if null, a simple 'wait' text is displayed
+ */
+ public void showWaitDialog(String waitMessage);
+
+ public void showInsertCardDialog(ActionListener cancelListener, String actionCommand);
+
+ public void showCardNotSupportedDialog(ActionListener cancelListener, String actionCommand);
+
+ public void showCardPINDialog(PINSpec pinSpec, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand);
+
+ public void showCardPINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand);
+
+ public void showSignaturePINDialog(PINSpec pinSpec, ActionListener signListener, String signCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand);
+
+ public void showSignaturePINRetryDialog(PINSpec pinSpec, int numRetries, ActionListener okListener, String okCommand, ActionListener cancelListener, String cancelCommand, ActionListener hashdataListener, String hashdataCommand);
+
+ public char[] getPin();
+
+ /**
+ * TODO move to HashDataDisplay implementations
+ * @param signedReferences
+ * @param externalDisplay
+ * @param okListener
+ * @param okCommand
+ */
+ public void showHashDataInputDialog(List signedReferences, boolean externalDisplay, ActionListener okListener, String okCommand);
+
+ /**
+ * TODO pull out from BKUGUIFacade. (or make this strictly an applet internal version)
+ * Problem: if standalone flag is provided, we also need the actionlistener..
+ * @param helpDocument
+ * @param mimeType
+ * @param encoding
+ */
+// public void showHelpDialog(InputStream helpDocument, String mimeType, String encoding); //, boolean standalone); //, ActionListener okListener, String okCommand);
+
// public void showPlainTextHashDataInputDialog(String text, ActionListener saveListener, String saveCommand, ActionListener cancelListener, String cancelCommand);
-
- public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams, ActionListener okListener, String actionCommand);
-
- public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams);
+ public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams, ActionListener okListener, String actionCommand);
+
+ public void showErrorDialog(String errorMsgKey, Object[] errorMsgParams);
}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
index aea85523..e8566fa6 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
@@ -64,13 +64,5 @@ class HashDataTableModel extends DefaultTableModel {
}
}
return selection;
- }// public List getSelectedReferenceIds() {
-// ArrayList selection = new ArrayList();
-// for (Object row : dataVector) {
-// if ((Boolean) ((Vector) row).elementAt(1)) {
-// selection.add((String) ((Vector) row).elementAt(0));
-// }
-// }
-// return selection;
-// }
+ }
}
\ No newline at end of file
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
deleted file mode 100644
index 3db06e19..00000000
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
+++ /dev/null
@@ -1,260 +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.stal.HashDataInput;
-import java.awt.Component;
-import java.awt.Container;
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.Font;
-import java.awt.Frame;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.WindowEvent;
-import java.awt.event.WindowListener;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.text.MessageFormat;
-import java.util.List;
-import java.util.ResourceBundle;
-import javax.swing.GroupLayout;
-import javax.swing.ImageIcon;
-import javax.swing.JButton;
-import javax.swing.JDialog;
-import javax.swing.JEditorPane;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPanel;
-import javax.swing.JScrollPane;
-import javax.swing.LayoutStyle;
-import javax.swing.text.Document;
-import javax.swing.text.EditorKit;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class HashDataViewer extends JDialog
- implements ActionListener, WindowListener {
-
- public static final String PLAINTEXT_FONT = "Monospaced";
-
- protected static final Log log = LogFactory.getLog(HashDataViewer.class);
- private static HashDataViewer dialog;
-
- public static void showDialog(Component frameComp, List signedReferences, ResourceBundle messages, ActionListener saveListener, String saveCommand, HelpMouseListener helpListener) {
-
- log.info("******************* SHOW HASHDATA DIALOG");
-
- Frame frame = JOptionPane.getFrameForComponent(frameComp);
-
- dialog = new HashDataViewer(frame, signedReferences.get(0), messages, saveListener, saveCommand, helpListener);
- dialog.addWindowListener(dialog);
- dialog.setVisible(true);
-
- }
-
- private HashDataViewer(Frame frame, HashDataInput hashData, ResourceBundle messages, ActionListener saveListener, String saveCommand, HelpMouseListener helpListener) {
- super(frame, messages.getString(BKUGUIFacade.WINDOWTITLE_VIEWER), true);
-
- JPanel viewerPanel = createViewerPanel(messages, hashData, helpListener);
- JPanel buttonPanel = createButtonPanel(messages, saveListener, saveCommand);
-
-
- Container contentPane = getContentPane();
- contentPane.setPreferredSize(new Dimension(400, 300));
-
- GroupLayout mainLayout = new GroupLayout(contentPane);
- contentPane.setLayout(mainLayout);
-
- mainLayout.setHorizontalGroup(
- mainLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(
- mainLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(viewerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addContainerGap());
- mainLayout.setVerticalGroup(
- mainLayout.createSequentialGroup()
- .addContainerGap()
- .addComponent(viewerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addContainerGap());
-
- pack();
- setLocationRelativeTo(frame);
- }
-
- private JPanel createViewerPanel(ResourceBundle messages, HashDataInput hashData, HelpMouseListener helpListener) {
- String mimeType = hashData.getMimeType();
- String encoding = hashData.getEncoding();
-
- log.debug("display hashdata: " + mimeType + ";" + encoding);
-
- if (mimeType == null) {
- mimeType = "text/plain";
- }
- if (encoding == null) {
- encoding = "UTF-8";
- }
-
- JEditorPane viewer = new JEditorPane();
- viewer.setEditable(false);
- viewer.setContentType(mimeType);
- if ("text/plain".equals(mimeType)) {
- viewer.setFont(new Font(PLAINTEXT_FONT, viewer.getFont().getStyle(), viewer.getFont().getSize()));
- }
-
- EditorKit editorKit = viewer.getEditorKit();
- Document document = editorKit.createDefaultDocument();
-
- Reader reader;
- try {
- reader = new InputStreamReader(hashData.getHashDataInput(), encoding);
- viewer.read(reader, document);
- } catch (Exception ex) {
- String p = messages.getString(BKUGUIFacade.ERR_DISPLAY_HASHDATA);
- viewer.setText(MessageFormat.format(p, ex.getMessage()));
- }
-
- JScrollPane scrollPane = new JScrollPane(viewer);
-// scrollPane.setPreferredSize(new Dimension(400, 300));
- scrollPane.setPreferredSize(viewer.getPreferredSize());
- scrollPane.setAlignmentX(LEFT_ALIGNMENT);
-
- JLabel viewerTitle = new JLabel();
- viewerTitle.setText(messages.getString(BKUGUIFacade.TITLE_HASHDATA));
- viewerTitle.setFont(viewerTitle.getFont().deriveFont(viewerTitle.getFont().getStyle() | java.awt.Font.BOLD));
- viewerTitle.setLabelFor(viewer);
-
- JLabel helpLabel = new JLabel();
- helpListener.setHelpTopic(BKUGUIFacade.HELP_HASHDATAVIEWER);
- helpLabel.setIcon(new ImageIcon(getClass().getResource(BKUGUIFacade.HELP_IMG)));
- helpLabel.addMouseListener(helpListener);
- helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
-
- JPanel viewerPanel = new JPanel();
- GroupLayout viewerPanelLayout = new GroupLayout(viewerPanel);
- viewerPanel.setLayout(viewerPanelLayout);
-
- viewerPanelLayout.setHorizontalGroup(
- viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(viewerPanelLayout.createSequentialGroup()
- .addComponent(viewerTitle)
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
- .addComponent(helpLabel))
- .addComponent(scrollPane)); //, 0, 0, Short.MAX_VALUE));
-
- viewerPanelLayout.setVerticalGroup(
- viewerPanelLayout.createSequentialGroup()
- .addGroup(viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(viewerTitle)
- .addComponent(helpLabel))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(scrollPane)); //, 0, 0, Short.MAX_VALUE));
-
-// viewerPanel.setLayout(new BoxLayout(viewerPanel, BoxLayout.PAGE_AXIS));
-// JLabel title = new JLabel(messages.getString(BKUGUIFacade.TITLE_HASHDATA));
-// title.setLabelFor(viewer);
-// viewerPanel.add(title);
-// viewerPanel.add(Box.createRigidArea(new Dimension(0, 5)));
-// viewerPanel.add(scrollPane);
-// viewerPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
-
- return viewerPanel;
- }
-
- private JPanel createButtonPanel(ResourceBundle messages, ActionListener saveListener, String saveCommand) {
- JButton closeButton = new JButton();
- closeButton.setText(messages.getString(BKUGUIFacade.BUTTON_CLOSE));
- closeButton.addActionListener(this);
-
- JButton saveButton = new JButton();
- saveButton.setText(messages.getString(BKUGUIFacade.BUTTON_SAVE));
- saveButton.setActionCommand(saveCommand);
- saveButton.addActionListener(saveListener);
-
- int buttonSize = closeButton.getPreferredSize().width;
- if (saveButton.getPreferredSize().width > buttonSize) {
- buttonSize = saveButton.getPreferredSize().width;
- }
-
- JPanel buttonPanel = new JPanel();
- GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
- buttonPanel.setLayout(buttonPanelLayout);
-
- buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(closeButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
- buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(saveButton).addComponent(closeButton));
-
- return buttonPanel;
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
-// if ("close".equals(e.getActionCommand())) {
- HashDataViewer.dialog.setVisible(false);
-// HashDataViewer.dialog.dispose();
- }
-
- @Override
- public void windowOpened(WindowEvent e) {
- log.debug("WINDOW OPENED");
- }
-
- @Override
- public void windowClosing(WindowEvent e) {
- log.debug("WINDOW CLOSING");
- }
-
- @Override
- public void windowClosed(WindowEvent e) {
- log.debug("WINDOW CLOSED");
- }
-
- @Override
- public void windowIconified(WindowEvent e) {
- log.debug("WINDOW ICONIFIED");
- }
-
- @Override
- public void windowDeiconified(WindowEvent e) {
- }
-
- @Override
- public void windowActivated(WindowEvent e) {
- log.debug("WINDOW ACTIVATED");
- }
-
- @Override
- public void windowDeactivated(WindowEvent e) {
- log.debug("WINDOW DEACTIVATED");
- }
-
-
-
-
-
-
-
-}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperLinkRenderer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperLinkRenderer.java
new file mode 100644
index 00000000..d9606177
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperLinkRenderer.java
@@ -0,0 +1,47 @@
+/*
+ * 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.stal.HashDataInput;
+import java.awt.Color;
+import java.awt.Component;
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.table.TableCellRenderer;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class HyperLinkRenderer extends JLabel implements TableCellRenderer {
+
+ @Override
+ public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+ HashDataInput hdi = (HashDataInput) value;
+ setText(hdi.getReferenceId() + " (" + hdi.getMimeType() + ")");
+ setBackground(Color.CYAN);
+ return this;
+ }
+
+// extends DefaultTableCellRenderer {
+//
+// @Override
+// public void setValue(Object value) {
+// HashDataInput hdi = (HashDataInput) value;
+// setText(hdi.getReferenceId() + " (" + hdi.getMimeType() + ")");
+// }
+}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
index 583dae0f..6250dd0e 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
@@ -83,7 +83,7 @@ public class SimpleGUI implements BKUGUIFacade {
protected int buttonSize;
- private static final int CHECKBOX_WIDTH = new JCheckBox().getPreferredSize().width;
+// private static final int CHECKBOX_WIDTH = new JCheckBox().getPreferredSize().width;
/**
* @param contentPane
@@ -924,16 +924,17 @@ public class SimpleGUI implements BKUGUIFacade {
}
} else {
- final HashDataTableModel tableModel = new HashDataTableModel(signedReferences);
-
- ActionListener saveHashDataListener = new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- showSaveHashDataInputDialog(tableModel.getSelectedHashData(), okListener, okCommand);
- }
- };
- showMultipleHashDataInputDialog(tableModel, okListener, okCommand, saveHashDataListener, "save");
+ SimpleHashDataTableModel tableModel = new SimpleHashDataTableModel(signedReferences);
+// final HashDataTableModel tableModel = new HashDataTableModel(signedReferences);
+//
+// ActionListener saveHashDataListener = new ActionListener() {
+//
+// @Override
+// public void actionPerformed(ActionEvent e) {
+// showSaveHashDataInputDialog(tableModel.getSelectedHashData(), okListener, okCommand);
+// }
+// };
+ showMultipleHashDataInputDialog(tableModel, okListener, okCommand);
}
}
@@ -953,7 +954,7 @@ public class SimpleGUI implements BKUGUIFacade {
log.debug("show plaintext hashdatainput dialog");
- HashDataViewer.showDialog(contentPane, signedReferences, messages, saveListener, saveCommand, helpListener);
+ ViewerDialog.showHashDataInput(contentPane, signedReferences, messages, saveListener, saveCommand, helpListener);
}
});
}
@@ -1052,7 +1053,8 @@ public class SimpleGUI implements BKUGUIFacade {
});
}
- private void showMultipleHashDataInputDialog(final TableModel signedReferences, final ActionListener cancelListener, final String cancelCommand, final ActionListener saveListener, final String saveCommand) {
+ private void showMultipleHashDataInputDialog(final TableModel signedReferences, final ActionListener cancelListener, final String cancelCommand) {
+// , final ActionListener saveListener, final String saveCommand
log.debug("scheduling multiple hashdatainput dialog");
@@ -1076,13 +1078,14 @@ public class SimpleGUI implements BKUGUIFacade {
refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.getRowCount()}));
JTable hashDataTable = new JTable();
+ hashDataTable.setDefaultRenderer(HashDataInput.class, new HyperLinkRenderer());
hashDataTable.setModel(signedReferences);
hashDataTable.setTableHeader(null);
// hashDataTable.setShowVerticalLines(false);
// hashDataTable.setRowSelectionAllowed(false);
- TableColumn selectCol = hashDataTable.getColumnModel().getColumn(1);
- selectCol.setMinWidth(CHECKBOX_WIDTH);
- selectCol.setMaxWidth(CHECKBOX_WIDTH);
+// TableColumn selectCol = hashDataTable.getColumnModel().getColumn(1);
+// selectCol.setMinWidth(CHECKBOX_WIDTH);
+// selectCol.setMaxWidth(CHECKBOX_WIDTH);
// hashDataTable.setPreferredScrollableViewportSize(mainPanel.getPreferredSize());
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleHashDataTableModel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleHashDataTableModel.java
new file mode 100644
index 00000000..463dbe81
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleHashDataTableModel.java
@@ -0,0 +1,60 @@
+/*
+ * 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.stal.HashDataInput;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+import javax.swing.table.DefaultTableModel;
+
+/**
+ *
+ * @author clemens
+ */
+class SimpleHashDataTableModel extends DefaultTableModel {
+
+ protected List signedReferences;
+
+ protected Class[] types = new Class[]{
+ java.lang.String.class
+ };
+
+ public SimpleHashDataTableModel(List signedReferences) {
+ super(0, 1);
+ this.signedReferences = signedReferences;
+ for (HashDataInput hashDataInput : signedReferences) {
+
+// String desc = hashDataInput.getReferenceId() + " (" + hashDataInput.getMimeType() + ")";
+ addRow(new Object[]{hashDataInput});
+ }
+ }
+
+ @Override
+ public Class getColumnClass(int columnIndex) {
+ return types[columnIndex];
+ }
+
+ @Override
+ public boolean isCellEditable(int rowIndex, int columnIndex) {
+ if (columnIndex == 1)
+ return true;
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerDialog.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerDialog.java
new file mode 100644
index 00000000..cd04ad98
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerDialog.java
@@ -0,0 +1,354 @@
+/*
+ * 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.stal.HashDataInput;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Frame;
+import java.awt.Point;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.charset.Charset;
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.ResourceBundle;
+import javax.swing.GroupLayout;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JEditorPane;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.LayoutStyle;
+import javax.swing.text.Document;
+import javax.swing.text.EditorKit;
+import javax.swing.text.html.HTMLDocument;
+import javax.swing.text.html.HTMLEditorKit;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class ViewerDialog extends JDialog
+ implements ActionListener {
+
+ public static final String PLAINTEXT_FONT = "Monospaced";
+ protected static final Log log = LogFactory.getLog(ViewerDialog.class);
+// private ViewerDialog dialog;
+
+ protected ResourceBundle messages;
+
+ /**
+ *
+ * @param frameComp
+ * @param signedReferences currently, only one hashdata input (the first in the list) is displayed
+ * @param messages
+ * @param saveListener
+ * @param saveCommand
+ * @param helpListener
+ */
+ public static void showHashDataInput(Component frameComp,
+ List hashDataInputs,
+ ResourceBundle messages,
+ ActionListener saveListener,
+ String saveCommand,
+ HelpMouseListener helpListener) {
+
+ Frame frame = null;
+ if (frameComp != null) {
+ JOptionPane.getFrameForComponent(frameComp);
+ }
+ ViewerDialog viewer = new ViewerDialog(frame,
+ messages,
+ hashDataInputs,
+ saveListener,
+ saveCommand,
+ helpListener);
+ viewer.setVisible(true);
+ }
+
+ public static void showHelp(Component frameComp,
+ String helpTopic,
+// Reader helpDocument,
+ InputStream helpDocument,
+ String mimeType,
+ ResourceBundle messages) {
+
+ Frame frame = null;
+ if (frameComp != null) {
+ JOptionPane.getFrameForComponent(frameComp);
+ }
+ ViewerDialog viewer = new ViewerDialog(frame, messages, helpTopic, helpDocument, mimeType);
+ viewer.setVisible(true);
+ }
+
+ /**
+ * TODO make encoding aware!
+ * @param frame
+ * @param title
+ * @param messages
+ * @param hashDataInputs
+ * @param saveListener
+ * @param saveCommand
+ * @param helpListener
+ */
+ private ViewerDialog(Frame frame,
+ ResourceBundle messages,
+ List hashDataInputs,
+ ActionListener saveListener,
+ String saveCommand,
+ HelpMouseListener helpListener) {
+ super(frame, messages.getString(BKUGUIFacade.WINDOWTITLE_VIEWER), true);
+ this.messages = messages;
+
+ HashDataInput hashData = hashDataInputs.get(0);
+
+// Charset cs;
+// if (hashData.getEncoding() == null) {
+// cs = Charset.forName("UTF-8");
+// } else {
+// try {
+// cs = Charset.forName(hashData.getEncoding());
+// } catch (Exception ex) {
+// log.debug("charset " + hashData.getEncoding() + " not supported, assuming UTF-8: " + ex.getMessage());
+// cs = Charset.forName("UTF-8");
+// }
+// }
+
+// InputStreamReader isr = new InputStreamReader(hashData.getHashDataInput(), cs);
+// Reader content = new BufferedReader(isr);
+ InputStream content = hashData.getHashDataInput();
+ String mimeType = hashData.getMimeType();
+ String encoding = hashData.getEncoding();
+
+ JPanel hashDataPanel = createViewerPanel(messages.getString(BKUGUIFacade.MESSAGE_HASHDATA), content, mimeType, encoding, helpListener);
+ JPanel buttonPanel = createButtonPanel(saveListener, saveCommand);
+ initContentPane(new Dimension(600, 400), hashDataPanel, buttonPanel);
+
+ pack();
+ if (frame != null) {
+ setLocationRelativeTo(frame);
+ } else {
+ setLocationByPlatform(true);
+ }
+ }
+
+ private ViewerDialog(Frame frame,
+ ResourceBundle messages,
+ String helpTopic,
+// Reader helpDocument,
+ InputStream helpDocument,
+ String mimeType) {
+ super(frame, messages.getString(BKUGUIFacade.WINDOWTITLE_HELP), true);
+ this.messages = messages;
+
+ String p = messages.getString(BKUGUIFacade.MESSAGE_HELP);
+ String helpItem = messages.getString(helpTopic);
+ String viewerLabel = MessageFormat.format(p, new Object[] {helpItem});
+
+ JPanel helpPanel = createViewerPanel(viewerLabel, helpDocument, mimeType, null, null);
+ JPanel buttonPanel = createButtonPanel();
+
+ initContentPane(new Dimension(600, 400), helpPanel, buttonPanel);
+ pack();
+ if (frame != null) {
+ setLocationRelativeTo(frame);
+ } else {
+ setLocationByPlatform(true);
+ }
+ }
+
+ private void initContentPane(Dimension preferredSize, JPanel viewerPanel, JPanel buttonPanel) {
+ Container contentPane = getContentPane();
+ contentPane.setPreferredSize(preferredSize);
+
+ GroupLayout mainLayout = new GroupLayout(contentPane);
+ contentPane.setLayout(mainLayout);
+
+ mainLayout.setHorizontalGroup(
+ mainLayout.createSequentialGroup().addContainerGap().addGroup(
+ mainLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(viewerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addContainerGap());
+ mainLayout.setVerticalGroup(
+ mainLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(viewerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(buttonPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap());
+ }
+
+ /**
+ *
+ * @param messages
+ * @param content
+ * @param mimeType defaults to text/plain if null
+ * @param encoding must be null if document contains charset declaration (e.g. HTML page), otherwise the parser crashes
+ * @param helpListener may be null
+ * @return
+ */
+ private JPanel createViewerPanel(String viewerLabelText, InputStream content, String mimeType, String encoding, HelpMouseListener helpListener) {
+ log.debug("viewer dialog: " + mimeType);
+
+ if (mimeType == null) {
+ mimeType = "text/plain";
+ } else if ("application/xhtml+xml".equals(mimeType)) {
+ mimeType = "text/html";
+ }
+
+ JEditorPane viewer = new JEditorPane();
+ viewer.setEditable(false);
+ viewer.setContentType(mimeType);
+ if ("text/plain".equals(mimeType)) {
+ viewer.setFont(new Font(PLAINTEXT_FONT, viewer.getFont().getStyle(), viewer.getFont().getSize()));
+ }
+
+ EditorKit editorKit = viewer.getEditorKit();
+ Document document = editorKit.createDefaultDocument();
+// document.putProperty("IgnoreCharsetDirective", new Boolean(true));
+
+ try {
+ if (encoding != null) {
+ BufferedReader contentReader = new BufferedReader(new InputStreamReader(content, encoding));
+ viewer.read(contentReader, document);
+ contentReader.close();
+ } else {
+ // charset declaration in content
+ viewer.read(content, document);
+ content.close();
+ }
+ } catch (Exception ex) {
+ log.error(ex.getMessage(), ex);
+ String p = messages.getString(BKUGUIFacade.ERR_VIEWER);
+ viewer.setText(MessageFormat.format(p, ex.getMessage()));
+ }
+
+ JScrollPane scrollPane = new JScrollPane(viewer);
+ scrollPane.setPreferredSize(viewer.getPreferredSize());
+ scrollPane.setAlignmentX(LEFT_ALIGNMENT);
+ viewer.setCaretPosition(0);
+
+ JLabel viewerLabel = new JLabel();
+ viewerLabel.setText(viewerLabelText);
+ viewerLabel.setFont(viewerLabel.getFont().deriveFont(viewerLabel.getFont().getStyle() | java.awt.Font.BOLD));
+ viewerLabel.setLabelFor(viewer);
+
+ JPanel viewerPanel = new JPanel();
+ GroupLayout viewerPanelLayout = new GroupLayout(viewerPanel);
+ viewerPanel.setLayout(viewerPanelLayout);
+
+ if (helpListener != null) {
+ JLabel helpLabel = new JLabel();
+ helpListener.setHelpTopic(BKUGUIFacade.HELP_HASHDATAVIEWER);
+ helpLabel.setIcon(new ImageIcon(getClass().getResource(BKUGUIFacade.HELP_IMG)));
+ helpLabel.addMouseListener(helpListener);
+ helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ viewerPanelLayout.setHorizontalGroup(
+ viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(viewerPanelLayout.createSequentialGroup().addComponent(viewerLabel).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel)).addComponent(scrollPane)); //, 0, 0, Short.MAX_VALUE));
+ viewerPanelLayout.setVerticalGroup(
+ viewerPanelLayout.createSequentialGroup()
+ .addGroup(viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(viewerLabel)
+ .addComponent(helpLabel))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(scrollPane));
+ } else {
+ viewerPanelLayout.setHorizontalGroup(
+ viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(viewerLabel)
+ .addComponent(scrollPane));
+ viewerPanelLayout.setVerticalGroup(
+ viewerPanelLayout.createSequentialGroup()
+ .addComponent(viewerLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(scrollPane));
+
+ }
+
+ return viewerPanel;
+ }
+
+ private JPanel createButtonPanel() {
+ JButton closeButton = new JButton();
+ closeButton.setText(messages.getString(BKUGUIFacade.BUTTON_CLOSE));
+ closeButton.addActionListener(this);
+
+ JPanel buttonPanel = new JPanel();
+ GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+ buttonPanel.setLayout(buttonPanelLayout);
+
+ buttonPanelLayout.setHorizontalGroup(
+ buttonPanelLayout.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(closeButton));
+ buttonPanelLayout.setVerticalGroup(
+ buttonPanelLayout.createSequentialGroup()
+ .addComponent(closeButton));
+ return buttonPanel;
+ }
+
+ private JPanel createButtonPanel(ActionListener saveListener, String saveCommand) {
+ JButton closeButton = new JButton();
+ closeButton.setText(messages.getString(BKUGUIFacade.BUTTON_CLOSE));
+ closeButton.addActionListener(this);
+
+ JButton saveButton = new JButton();
+ saveButton.setText(messages.getString(BKUGUIFacade.BUTTON_SAVE));
+ saveButton.setActionCommand(saveCommand);
+ saveButton.addActionListener(saveListener);
+
+ int buttonSize = closeButton.getPreferredSize().width;
+ if (saveButton.getPreferredSize().width > buttonSize) {
+ buttonSize = saveButton.getPreferredSize().width;
+ }
+
+ JPanel buttonPanel = new JPanel();
+ GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+ buttonPanel.setLayout(buttonPanelLayout);
+
+ buttonPanelLayout.setHorizontalGroup(
+ buttonPanelLayout.createSequentialGroup().addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(closeButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
+ buttonPanelLayout.setVerticalGroup(
+ buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(saveButton).addComponent(closeButton));
+
+ return buttonPanel;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+// if ("close".equals(e.getActionCommand())) {
+// ViewerDialog.dialog.setVisible(false);
+// HashDataViewer.dialog.dispose();
+ this.setVisible(false);
+ }
+}
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index c47242b2..ba20471d 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -26,14 +26,17 @@ windowtitle.save=Signaturdaten speichern
windowtitle.savedir=Signaturdaten in Verzeichnis speichern
windowtitle.overwrite=Datei \u00FCberschreiben?
windowtitle.viewer=Signaturedaten
+windowtitle.help=Hilfe
message.wait=Bitte warten...
message.insertcard=Bitte die B\u00FCrgerkarte in den Kartenleser stecken
message.enterpin={0} eingeben
message.hashdatalink=Signaturdaten anzeigen
-message.hashdata=Signaturdaten:
+message.hashdata=Dies ist eine Voransicht des zu signierenden Inhaltes. F\u00FCr Details siehe Hilfe.
+#verwenden sie bitte die von ihrem System zur Verf\u00FCgung gestellte {0} Anwendung.
message.hashdatalist={0} Signaturdaten:
message.retries=Noch {0} Versuch(e)
message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?
+message.help=Hilfe zu {0}
label.pin={0}:
label.pinsize=({0} stellig)
button.ok=OK
@@ -62,4 +65,17 @@ error.cardterminal=Es konnte kein Smartcard-Leser gefunden werden
error.unknown=Leider trat ein Fehler auf: {0}
error.test=Fehler1 {0} - Fehler2 {1}
error.card.locked=B\u00FCrgerkarte ist gesperrt
-error.card.notactivated=B\u00FCrgerkartenfunktion ist nicht aktiviert
\ No newline at end of file
+error.card.notactivated=B\u00FCrgerkartenfunktion ist nicht aktiviert
+error.viewer=Der Inhalt kann nicht dargestellt werden: {0}
+
+# Help Topics
+help.welcome=Startseite
+help.wait=Bitte Warten Bildschirm
+help.cardnotsupported=Nicht unterst\u00FCtzte B\u00FCrgerkarte
+help.insertcard=Keine B\u00FCrgerkarte im Kartenleser
+help.cardpin=Pineingabe
+help.signpin=Signatur-Pineingabe
+help.retry=Falscher Pin
+help.hashdata=Signierte Inhalte
+help.hashdatalist=Signierte Inhalte
+help.hashdataviewer=Anzeige signierter Inhalte
\ No newline at end of file
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
index c7cc9084..edc5371d 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
@@ -26,6 +26,7 @@ windowtitle.save=Save signature data
windowtitle.savedir=Save signature data to directory
windowtitle.overwrite=Overwrite file?
windowtitle.viewer=Signature data
+windowtitle.help=Help
message.wait=Please wait...
message.insertcard=Please insert your citizen-card into the reader
message.enterpin=Enter {0}
@@ -34,6 +35,7 @@ message.hashdata=Signature data:
message.hashdatalist={0} signature data objects:
message.retries={0} tries left
message.overwrite=Overwrite {0}?
+message.help=Help topic {0}
label.pin={0}:
label.pinsize=({0} digits)
button.ok=OK
@@ -61,4 +63,17 @@ error.cardterminal=Could not find smartcard reader
error.unknown=An error occured: {0}
error.test=Error1 {0} - Error2 {1}
error.card.locked=Citizen-card is locked
-error.card.notactivated=Citizen-card not activated
\ No newline at end of file
+error.card.notactivated=Citizen-card not activated
+error.viewer=Failed to display contents: {0}
+
+# Help Topics
+help.welcome=Welcome page
+help.wait=Wait screen
+help.cardnotsupported=Unsupported citizen card
+help.insertcard=No citizen card found
+help.cardpin=Pin entry
+help.signpin=Signature pin entry
+help.retry=Wrong Pin
+help.hashdata=Signed contents
+help.hashdatalist=Signed contents
+help.hashdataviewer=Display of signed contents
\ No newline at end of file
diff --git a/BKUCommonGUI/src/main/resources/images/help.png b/BKUCommonGUI/src/main/resources/images/help.png
index 4ed65a97..5d6da3bf 100644
Binary files a/BKUCommonGUI/src/main/resources/images/help.png and b/BKUCommonGUI/src/main/resources/images/help.png differ
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index c366cb76..af1368e5 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -176,7 +176,7 @@ public class BKUGUIWorker implements Runnable {
// signedRefs.add(signedRef4);
// signedRefs.add(signedRef4);
// signedRefs = Collections.singletonList(signedRef1);
- gui.showHashDataInputDialog(signedRefs, returnListener, "return");
+ gui.showHashDataInputDialog(signedRefs, true, returnListener, "return");
}
};
diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
index 7faad548..05a3f5e5 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java
@@ -64,10 +64,14 @@ public class STALServiceImpl implements STALPortType {
protected static final Log log = LogFactory.getLog(STALServiceImpl.class);
static {
+
if (log.isTraceEnabled()) {
log.trace("enabling webservice communication dump");
System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
+ } else {
+ System.setProperty("com.sun.xml.ws.fault.SOAPFaultBuilder.disableCaptureStackTrace", "false");
}
+
}
@Resource
@@ -291,8 +295,8 @@ public class STALServiceImpl implements STALPortType {
throw new GetHashDataInputFault(msg, faultInfo);
}
} else {
- String msg = "Failed to get STAL for session " + sessionId;
- log.error(msg);
+ String msg = "Session timeout"; //Failed to get STAL for session " + sessionId;
+ log.error(msg + " " + sessionId);
GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType();
faultInfo.setErrorCode(1);
faultInfo.setErrorMessage(msg);
diff --git a/BKUOnline/src/test/java/at/gv/egiz/bku/online/conf/SSLConfigTest.java b/BKUOnline/src/test/java/at/gv/egiz/bku/online/conf/SSLConfigTest.java
index 612480b2..eefaf5b6 100644
--- a/BKUOnline/src/test/java/at/gv/egiz/bku/online/conf/SSLConfigTest.java
+++ b/BKUOnline/src/test/java/at/gv/egiz/bku/online/conf/SSLConfigTest.java
@@ -11,6 +11,7 @@ import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+@Ignore
public class SSLConfigTest {
private SpringConfigurator cfg;
@@ -21,7 +22,7 @@ public class SSLConfigTest {
ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
}
-
+
@Ignore
@Test
public void testConnect() throws Exception {
diff --git a/STALService/pom.xml b/STALService/pom.xml
index e9c573f1..db126b3c 100644
--- a/STALService/pom.xml
+++ b/STALService/pom.xml
@@ -18,10 +18,10 @@
STAL
1.0-SNAPSHOT
-
+
\ No newline at end of file
diff --git a/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java b/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java
deleted file mode 100644
index 01d207d2..00000000
--- a/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package at.gv.egiz.stal.util;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.utils.StreamUtil;
-import at.gv.egiz.stal.HashDataInput;
-
-/**
- * Enables multiple read requests.
- * @deprecated use at.gv.egiz.stal.impl.ByteArrayHashDataInput
- */
-public class HashDataInputProxy implements HashDataInput {
-
- private static Log log = LogFactory.getLog(HashDataInputProxy.class);
-
- private HashDataInput delegate;
- private byte[] hashInput;
-
- /**
- *
- * @param delegate
- * != null
- */
- public HashDataInputProxy(HashDataInput delegate) {
- if (delegate == null) {
- throw new NullPointerException("Constructor argument must not be null");
- }
- this.delegate = delegate;
- }
-
- @Override
- public String getEncoding() {
- return delegate.getEncoding();
- }
-
- @Override
- public InputStream getHashDataInput() {
- if (hashInput == null) {
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- try {
- StreamUtil.copyStream(delegate.getHashDataInput(), os);
- hashInput = os.toByteArray();
- } catch (IOException e) {
- log.error("Cannot access hashdatainput stream", e);
- hashInput = new byte[0];
- }
- }
- return new ByteArrayInputStream(hashInput);
- }
-
- @Override
- public String getMimeType() {
- return delegate.getMimeType();
- }
-
- @Override
- public String getReferenceId() {
- return delegate.getReferenceId();
- }
-
-}
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/HashDataInputDisplay.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/HashDataInputDisplay.java
index f79a2027..59700d4a 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/HashDataInputDisplay.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/HashDataInputDisplay.java
@@ -1,6 +1,18 @@
/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
+ * 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;
@@ -14,7 +26,11 @@ import java.util.List;
*/
public interface HashDataInputDisplay {
+
/**
+ * TODO: (see AbstractHelpListener)
+ *
+ *
* Displays the hashdata inputs for all provided dsig:SignedReferences.
* Implementations may verify the digest value if necessary.
* (LocalSignRequestHandler operates on DataObjectHashDataInput,
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
index 6c30a68a..77ee45b6 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
@@ -192,7 +192,7 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen
- class STALPinProvider implements PINProvider, ActionListener {
+ class STALPinProvider implements PINProvider {
protected SignedInfoType signedInfo;
protected List hashDataInputs;
@@ -230,10 +230,10 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen
displayHashDataInputs(signedInfo.getReference());
} catch (DigestException ex) {
log.error("Bad digest value: " + ex.getMessage());
- gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH, new Object[] {ex.getMessage()});
+ gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH, new Object[] {ex.getMessage()}, SignRequestHandler.this, "error");
} catch (Exception ex) {
log.error("Could not display hashdata inputs: " + ex.getMessage());
- gui.showErrorDialog(BKUGUIFacade.ERR_DISPLAY_HASHDATA, new Object[] {ex.getMessage()}, SignRequestHandler.this, "ok");
+ gui.showErrorDialog(BKUGUIFacade.ERR_DISPLAY_HASHDATA, new Object[] {ex.getMessage()}, SignRequestHandler.this, "error");
}
// OLD HASHDATA DISPLAY (in applet),
@@ -261,13 +261,15 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen
return new String(gui.getPin());
} else if (actionCommand.equals("ok")) {
showSignaturePINDialog(spec, retries);
+ } else if (actionCommand.equals("error")) {
+ return null;
}
} while (true);
}
- @Override
- public void actionPerformed(ActionEvent e) {
- throw new UnsupportedOperationException("Not supported yet.");
- }
+// @Override
+// public void actionPerformed(ActionEvent e) {
+// throw new UnsupportedOperationException("Not supported yet.");
+// }
}
}
--
cgit v1.2.3
From 28e81afd92a6568ff78736b72c5257a86c0b9b91 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Tue, 18 Nov 2008 08:03:35 +0000
Subject: GUI refactoring 1
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@177 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../gv/egiz/bku/online/applet/AppletBKUWorker.java | 13 +-
.../bku/online/applet/AppletHashDataDisplay.java | 24 +-
.../at/gv/egiz/bku/online/applet/BKUApplet.java | 6 +-
BKUApplet/src/test/resources/appletTest.html | 3 +-
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 6 +-
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 6 +-
.../java/at/gv/egiz/bku/gui/BKUGUIFactory.java | 25 +-
.../at/gv/egiz/bku/gui/DefaultHelpListener.java | 37 +-
.../java/at/gv/egiz/bku/gui/HashDataViewer.java | 6 -
.../main/java/at/gv/egiz/bku/gui/HelpViewer.java | 2 +-
.../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 1165 +++++++++++---------
.../at/gv/egiz/bku/gui/Messages.properties | 2 +-
.../at/gv/egiz/bku/gui/Messages_en.properties | 2 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 5 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 110 +-
.../at/gv/egiz/bku/local/stal/BKUGuiProxy.java | 12 +-
.../bku/local/stal/LocalSignRequestHandler.java | 2 +-
.../at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 7 +-
BKUOnline/src/main/webapp/HTTP-ohne.html | 2 +-
.../gv/egiz/bku/smccstal/SignRequestHandler.java | 81 --
20 files changed, 793 insertions(+), 723 deletions(-)
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
index f862360b..b2f9f89c 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
@@ -192,18 +192,19 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable {
private void registerSignRequestHandler() throws MalformedURLException {
String hashDataDisplayStyle = params.getAppletParameter(BKUApplet.HASHDATA_DISPLAY);
- if (BKUApplet.HASHDATA_DISPLAY_INTERNAL.equals(hashDataDisplayStyle)) {
- log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL);
- AppletHashDataDisplay handler = new AppletHashDataDisplay(stalPort, sessionId, AppletHashDataDisplay.DISPLAY.applet);
- addRequestHandler(SignRequest.class, handler);
- } else if (BKUApplet.HASHDATA_DISPLAY_BROWSER.equals(hashDataDisplayStyle)) {
+// if (BKUApplet.HASHDATA_DISPLAY_INTERNAL.equals(hashDataDisplayStyle)) {
+// log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL);
+// AppletHashDataDisplay handler = new AppletHashDataDisplay(stalPort, sessionId, AppletHashDataDisplay.DISPLAY.applet);
+// addRequestHandler(SignRequest.class, handler);
+// } else
+ if (BKUApplet.HASHDATA_DISPLAY_BROWSER.equals(hashDataDisplayStyle)) {
URL hashDataURL = params.getURLParameter(BKUApplet.HASHDATA_URL, sessionId);
log.debug("register SignRequestHandler for HashDataURL " + hashDataURL);
addRequestHandler(SignRequest.class, new BrowserHashDataDisplay(ctx, hashDataURL));
} else {
//BKUApplet.HASHDATA_DISPLAY_FRAME
log.debug("register SignRequestHandler for STAL port " + BKUApplet.WSDL_URL);
- AppletHashDataDisplay handler = new AppletHashDataDisplay(stalPort, sessionId, AppletHashDataDisplay.DISPLAY.frame);
+ AppletHashDataDisplay handler = new AppletHashDataDisplay(stalPort, sessionId);
addRequestHandler(SignRequest.class, handler);
}
}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java
index 29a60f1d..ba502906 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java
@@ -50,33 +50,32 @@ import java.security.NoSuchAlgorithmException;
*/
public class AppletHashDataDisplay extends SignRequestHandler {
- public static enum DISPLAY {
- applet, frame
- }
private static final Log log = LogFactory.getLog(AppletHashDataDisplay.class);
protected STALPortType stalPort;
protected String sessId;
- protected DISPLAY display;
- public AppletHashDataDisplay(STALPortType stalPort, String sessId, DISPLAY display) {
+ public AppletHashDataDisplay(STALPortType stalPort, String sessId) {
if (stalPort == null || sessId == null) {
throw new NullPointerException("STAL port must not be null");
}
this.sessId = sessId;
this.stalPort = stalPort;
- this.display = display;
}
+ /**
+ * TODO don't throw exceptions
+ * @param signedReferences
+ * @throws java.security.DigestException
+ * @throws java.lang.Exception
+ */
@Override
public void displayHashDataInputs(List signedReferences) throws DigestException, Exception {
List hdi = getHashDataInput(signedReferences);
List verifiedHashDataInputs = verifyHashDataInput(signedReferences, hdi);
- if (verifiedHashDataInputs.size() > 1) {
- gui.showHashDataInputDialog(verifiedHashDataInputs, false, this, "ok");
- } else if (verifiedHashDataInputs.size() == 1) {
- gui.showHashDataInputDialog(verifiedHashDataInputs, display==DISPLAY.frame, this, "ok");
+ if (verifiedHashDataInputs.size() > 0) {
+ gui.showHashDataInputDialog(verifiedHashDataInputs, this, "ok");
} else {
throw new Exception("No signature data (apart from any QualifyingProperties or a Manifest)");
}
@@ -111,6 +110,11 @@ public class AppletHashDataDisplay extends SignRequestHandler {
}
}
}
+
+ if (request.getReference().size() < 1) {
+ log.error("No signature data (apart from any QualifyingProperties or a Manifest) for session " + sessId);
+ throw new Exception("No signature data (apart from any QualifyingProperties or a Manifest)");
+ }
if (log.isDebugEnabled()) {
log.debug("WebService call GetHashDataInput for " + request.getReference().size() + " references in session " + sessId);
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
index 7963768e..5b45c8e1 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
@@ -53,7 +53,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
public static final String BACKGROUND_PARAM = "Background";
public static final String REDIRECT_URL = "RedirectURL";
public static final String REDIRECT_TARGET = "RedirectTarget";
- public static final String HASHDATA_DISPLAY_INTERNAL = "internal";
+// public static final String HASHDATA_DISPLAY_INTERNAL = "internal";
public static final String HASHDATA_DISPLAY_BROWSER = "browser";
public static final String HASHDATA_DISPLAY_FRAME = "frame";
@@ -106,8 +106,8 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
}
log.debug("setting locale to " + getLocale());
- BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle);
- gui.init(getContentPane(), getLocale(), backgroundImgURL, helpListener);
+ BKUGUIFacade gui = BKUGUIFactory.createGUI(getContentPane(), getLocale(), guiStyle, backgroundImgURL, helpListener);
+// gui.init(getContentPane(), getLocale(), BKUGUIFacade.Style.advanced, backgroundImgURL, helpListener);
worker = new AppletBKUWorker(gui, getAppletContext(), this);
}
diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html
index eaf6376d..8204d0eb 100644
--- a/BKUApplet/src/test/resources/appletTest.html
+++ b/BKUApplet/src/test/resources/appletTest.html
@@ -21,7 +21,8 @@
archive="../BKUApplet-1.0-SNAPSHOT.jar, ../test-libs/commons-logging-1.1.1.jar , ../test-libs/iaik_jce_me4se-3.04.jar"
width=300 height=200>
-
+
+
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
index d661c71a..f68f2ece 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
@@ -87,8 +87,8 @@ public class BKUGUI implements BKUGUIFacade {
* @param contentPane
* @param localeString may be null
*/
- @Override
- public void init(final Container contentPane, Locale locale, final URL background, ActionListener helpListener) {
+// @Override
+ public void init(final Container contentPane, Locale locale, Style guiStyle, final URL background, ActionListener helpListener) {
if (locale != null) {
messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, locale);
@@ -814,7 +814,7 @@ public class BKUGUI implements BKUGUIFacade {
}
@Override
- public void showHashDataInputDialog(final List signedReferences, boolean standalone, final ActionListener okListener, final String okCommand) {
+ public void showHashDataInputDialog(final List signedReferences, final ActionListener okListener, final String okCommand) {
if (signedReferences == null) {
showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {"No SignedReferences provided"}, okListener, okCommand);
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index 87982c79..2dbba730 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -91,7 +91,9 @@ public interface BKUGUIFacade {
public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix";
public static final String ALT_HELP = "alt.help";
- public void init(Container contentPane, Locale locale, URL background, ActionListener helpListener);
+ public enum Style { simple, advanced };
+
+// public void init(Container contentPane, Locale locale, Style guiStyle, URL background, ActionListener helpListener);
/**
*
@@ -128,7 +130,7 @@ public interface BKUGUIFacade {
* @param okListener
* @param okCommand
*/
- public void showHashDataInputDialog(List signedReferences, boolean externalDisplay, ActionListener okListener, String okCommand);
+ public void showHashDataInputDialog(List signedReferences, ActionListener okListener, String okCommand);
/**
* TODO pull out from BKUGUIFacade. (or make this strictly an applet internal version)
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java
index 87676026..f4981614 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java
@@ -17,24 +17,29 @@
package at.gv.egiz.bku.gui;
+import java.awt.Container;
+import java.awt.event.ActionListener;
+import java.net.URL;
+import java.util.Locale;
+
public class BKUGUIFactory {
public static final String SIMPLE_GUI = "simple";
public static final String ADVANCED_GUI = "advanced";
- private static BKUGUIFactory instance = new BKUGUIFactory();
+// private static BKUGUIFactory instance = new BKUGUIFactory();
- private BKUGUIFactory() {
- }
+// private BKUGUIFactory() {
+// }
+//
+// protected BKUGUIFacade createNewGUI(Container contentPane, Locale locale, String style, URL background, ActionListener helpListener) {
+//
+// }
- protected BKUGUIFacade createNewGUI(String style) {
+ public static BKUGUIFacade createGUI(Container contentPane, Locale locale, String style, URL background, ActionListener helpListener) {
if (ADVANCED_GUI.equals(style)) {
- return new BKUGUI();
+ return new SimpleGUI(contentPane, locale, BKUGUIFacade.Style.advanced, background, helpListener);
}
- return new SimpleGUI();
- }
-
- public static BKUGUIFacade createGUI(String style) {
- return instance.createNewGUI(style);
+ return new SimpleGUI(contentPane, locale, BKUGUIFacade.Style.simple, background, helpListener);
}
}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java
index ba968a48..f03bf158 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java
@@ -17,6 +17,7 @@
package at.gv.egiz.bku.gui;
import java.applet.AppletContext;
+import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.Locale;
import javax.swing.SwingUtilities;
@@ -29,34 +30,56 @@ public class DefaultHelpListener extends AbstractHelpListener {
protected AppletContext ctx;
+ /**
+ *
+ * @param ctx open external links via applet context
+ * @param helpURL
+ * @param locale
+ */
public DefaultHelpListener(AppletContext ctx, URL helpURL, Locale locale) {
super(helpURL, locale);
this.ctx = ctx;
}
+ /**
+ * external links in help document are not opened
+ * @param helpURL
+ * @param locale
+ */
public DefaultHelpListener(URL helpURL, Locale locale) {
super(helpURL, locale);
this.ctx = null;
}
+ /**
+ * blocks until help viewer returns (is closed)
+ * @param helpURL
+ * @param helpTopic
+ */
@Override
- public void showDocument(final URL helpURL, final String helpTopic) throws Exception {
- log.debug("schedule help dialog");
-
- SwingUtilities.invokeLater(new Runnable() {
+ public void showDocument(final URL helpURL, final String helpTopic) {
+// try {
+ log.debug("schedule help dialog");
+
+// SwingUtilities.invokeAndWait(new Runnable() {
+ SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
-
+
log.debug("show help dialog");
-
+
if (ctx == null) {
HelpViewer.showHelpDialog(helpURL, helpTopic, messages);
-
} else {
HelpViewer.showHelpDialog(ctx, helpURL, helpTopic, messages);
}
}
});
+// } catch (InterruptedException ex) {
+// log.error("Failed to display HelpViewer: " + ex.getMessage(), ex);
+// } catch (InvocationTargetException ex) {
+// log.error("Failed to display HelpViewer: " + ex.getMessage(), ex);
+// }
}
}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
index 31887bde..7b77faeb 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
@@ -16,7 +16,6 @@
*/
package at.gv.egiz.bku.gui;
-import at.gv.egiz.bku.gui.html.RestrictedHTMLEditorKit;
import at.gv.egiz.stal.HashDataInput;
import java.awt.Component;
import java.awt.Container;
@@ -49,11 +48,6 @@ import javax.swing.JScrollPane;
import javax.swing.LayoutStyle;
import javax.swing.text.Document;
import javax.swing.text.EditorKit;
-import javax.swing.text.Element;
-import javax.swing.text.ViewFactory;
-import javax.swing.text.html.HTML;
-import javax.swing.text.html.HTMLEditorKit;
-import javax.swing.text.html.ImageView;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java
index 173254e7..0fef3f75 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java
@@ -105,7 +105,7 @@ public class HelpViewer extends JDialog
JPanel helpPanel = createViewerPanel(viewerLabel, helpURL);
JPanel buttonPanel = createButtonPanel();
- initContentPane(new Dimension(600, 400), helpPanel, buttonPanel);
+ initContentPane(new Dimension(600, 600), helpPanel, buttonPanel);
pack();
if (frame != null) {
setLocationRelativeTo(frame);
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
index bb568b75..d4d6efef 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
@@ -32,6 +32,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.text.MessageFormat;
import java.util.List;
@@ -40,7 +41,6 @@ import java.util.ResourceBundle;
import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
-import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
@@ -51,7 +51,6 @@ import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.LayoutStyle;
import javax.swing.SwingUtilities;
-import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -69,38 +68,60 @@ public class SimpleGUI implements BKUGUIFacade {
protected Container contentPane;
protected ResourceBundle messages;
/** left and right side main panels */
-// protected JPanel iconPanel;
+ protected JPanel iconPanel;
protected JPanel contentPanel;
/** right side content panels and layouts */
-// protected JPanel headerPanel;
+ protected JPanel headerPanel;
protected JPanel mainPanel;
protected JPanel buttonPanel;
/** right side fixed labels */
-// protected JLabel titleLabel;
+ protected JLabel titleLabel;
protected JLabel helpLabel;
/** remember the pinfield to return to worker */
protected JPasswordField pinField;
protected int buttonSize;
-// private static final int CHECKBOX_WIDTH = new JCheckBox().getPreferredSize().width;
+ /** gui style config (default 'simple') */
+ protected boolean renderHeaderPanel = false;
+ protected boolean renderIconPanel = false;
+ protected boolean renderCancelButton = false;
/**
+ * set contentPane
+ * init message bundle
+ * configure the style
+ * register the help listener
+ * create GUI (on event-dispatching thread)
+ *
* @param contentPane
- * @param localeString may be null
+ * @param locale
+ * @param guiStyle
+ * @param background
+ * @param helpListener
*/
- @Override
- public void init(final Container contentPane, Locale locale, final URL background, ActionListener helpListener) {
+ public SimpleGUI(Container contentPane, Locale locale, Style guiStyle, URL background, ActionListener helpListener) {
+ this.contentPane = contentPane;
- if (locale != null) {
- messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, locale);
- } else {
- messages = ResourceBundle.getBundle(MESSAGES_BUNDLE);
- }
+ if (locale != null) {
+ messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, locale);
+ } else {
+ messages = ResourceBundle.getBundle(MESSAGES_BUNDLE);
+ }
+
+ if (guiStyle == Style.advanced) {
+ renderHeaderPanel = true;
+ renderIconPanel = false;
+ renderCancelButton = true;
+ }
+
+ registerHelpListener(helpListener);
+
+ createGUI(background);
+ }
+
+ private void createGUI(final URL background) {
- this.contentPane = contentPane;
- registerHelpListener(helpListener);
-
try {
log.debug("scheduling gui initialization");
@@ -112,21 +133,28 @@ public class SimpleGUI implements BKUGUIFacade {
log.debug("initializing gui");
-// initIconPanel();
+ if (renderIconPanel) {
+ initIconPanel(background);
+ initContentPanel(null);
+ } else {
initContentPanel(background);
-
- GroupLayout layout = new GroupLayout(contentPane);
- contentPane.setLayout(layout);
+ }
+
+ GroupLayout layout = new GroupLayout(contentPane);
+ contentPane.setLayout(layout);
+
+ if (renderIconPanel) {
+ layout.setHorizontalGroup(layout.createSequentialGroup()
+ .addComponent(iconPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
+ layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(iconPanel, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
+ } else {
layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(contentPanel));
layout.setVerticalGroup(layout.createSequentialGroup().addComponent(contentPanel));
-// layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
-// .addGroup(layout.createSequentialGroup()
-// .addComponent(iconPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
-// .addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
-// layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
-// .addComponent(iconPanel, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-// .addComponent(contentPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
+ }
}
});
} catch (Exception ex) {
@@ -134,119 +162,113 @@ public class SimpleGUI implements BKUGUIFacade {
}
}
-// protected void initIconPanel() {
-// iconPanel = new JPanel();
-// JLabel iconLabel = new JLabel();
-// iconLabel.setIcon(new ImageIcon(getClass().getResource(LOGO_RESOURCE))); // NOI18N
-//
-// GroupLayout iconPanelLayout = new GroupLayout(iconPanel);
-// iconPanel.setLayout(iconPanelLayout);
-// iconPanelLayout.setHorizontalGroup(
-// iconPanelLayout.createSequentialGroup()
-// .addContainerGap()
-// .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, iconLabel.getPreferredSize().width, GroupLayout.PREFERRED_SIZE)
-// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //);
-// iconPanelLayout.setVerticalGroup(
-// iconPanelLayout.createSequentialGroup()
-// .addContainerGap()
-// .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, iconLabel.getPreferredSize().height, GroupLayout.PREFERRED_SIZE)
-// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //);
-// }
+ protected void initIconPanel(URL background) {
+ if (background == null) {
+ background = getClass().getResource(DEFAULT_BACKGROUND);
+ }
+ if ("file".equals(background.getProtocol())) {
+ log.warn("file:// background images not permitted: " + background);
+ background = getClass().getResource(DEFAULT_BACKGROUND);
+ }
+ log.debug("loading icon panel background " + background);
+
+ iconPanel = new JPanel();
+ JLabel iconLabel = new JLabel();
+ iconLabel.setIcon(new ImageIcon(background));
+
+ GroupLayout iconPanelLayout = new GroupLayout(iconPanel);
+ iconPanel.setLayout(iconPanelLayout);
+ iconPanelLayout.setHorizontalGroup(
+ iconPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE));
+ // no gap here (contentPanel has containerGap)
+ iconPanelLayout.setVerticalGroup(
+ iconPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(iconLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
+ }
protected void initContentPanel(URL background) {
if (background == null) {
- background = this.getClass().getResource(DEFAULT_BACKGROUND);
+ background = getClass().getResource(DEFAULT_BACKGROUND);
}
if ("file".equals(background.getProtocol())) {
- log.warn("local background image not allowed: " + background);
- background = this.getClass().getResource(DEFAULT_BACKGROUND);
+ log.warn("file:// background images not permitted: " + background);
+ background = getClass().getResource(DEFAULT_BACKGROUND);
}
log.debug("loading background " + background);
contentPanel = new ImagePanel(background);
-// contentPanel.setBorder(new TitledBorder("content"));
-
-// headerPanel = new JPanel();
-// headerPanel.setOpaque(false);
- mainPanel = new JPanel();
- mainPanel.setOpaque(false);
- buttonPanel = new JPanel();
- buttonPanel.setOpaque(false);
-
-// headerPanel.setBorder(new TitledBorder("header"));
-// mainPanel.setBorder(new TitledBorder("main"));
-// buttonPanel.setBorder(new TitledBorder("button"));
-
-// titleLabel = new JLabel();
-// titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() |
-// java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2));
-
- helpLabel = new JLabel();
- helpLabel.setIcon(new ImageIcon(getClass().getResource(HELP_IMG)));
- helpLabel.getAccessibleContext().setAccessibleName(messages.getString(ALT_HELP));
- helpLabel.addMouseListener(helpListener);
- helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
-
- JButton b = new JButton();
-// b.setText(messages.getString(BUTTON_CANCEL));
-// if (b.getPreferredSize().width > buttonSize)
-// buttonSize = b.getPreferredSize().width;
- b.setText(messages.getString(BUTTON_OK));
- if (b.getPreferredSize().width > buttonSize)
- buttonSize = b.getPreferredSize().width;
- b.setText(messages.getString(BUTTON_SIGN));
- if (b.getPreferredSize().width > buttonSize)
- buttonSize = b.getPreferredSize().width;
- b.setText(messages.getString(BUTTON_BACK));
- if (b.getPreferredSize().width > buttonSize)
- buttonSize = b.getPreferredSize().width;
-// b.setText(messages.getString(BUTTON_SAVE));
-// if (b.getPreferredSize().width > buttonSize)
-// buttonSize = b.getPreferredSize().width;
-
-// if (cancelButton.getPreferredSize().width > buttonSize)
-// buttonSize = cancelButton.getPreferredSize().width;
-// if (signButton.getPreferredSize().width > buttonSize)
-// buttonSize = signButton.getPreferredSize().width;
-// if (backButton.getPreferredSize().width > buttonSize)
-// buttonSize = backButton.getPreferredSize().width;
-// if (saveButton.getPreferredSize().width > buttonSize)
-// buttonSize = saveButton.getPreferredSize().width;
+ mainPanel = new JPanel();
+ mainPanel.setOpaque(false);
+ buttonPanel = new JPanel();
+ buttonPanel.setOpaque(false);
+ helpLabel = new JLabel();
+ helpLabel.setIcon(new ImageIcon(getClass().getResource(HELP_IMG)));
+ helpLabel.getAccessibleContext().setAccessibleName(messages.getString(ALT_HELP));
+ helpLabel.addMouseListener(helpListener);
+ helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+
+ buttonSize = initButtonSize(messages, renderCancelButton);
-// GroupLayout headerPanelLayout = new GroupLayout(headerPanel);
-// headerPanel.setLayout(headerPanelLayout);
-//
-// headerPanelLayout.setHorizontalGroup(
-// headerPanelLayout.createSequentialGroup()
-// .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
-// headerPanelLayout.setVerticalGroup(
-// headerPanelLayout.createSequentialGroup()
-// .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
-
-
- GroupLayout contentPanelLayout = new GroupLayout(contentPanel);
- contentPanel.setLayout(contentPanelLayout);
-
- contentPanelLayout.setHorizontalGroup(
- contentPanelLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(
- contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
-// .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addContainerGap());
- contentPanelLayout.setVerticalGroup(
- contentPanelLayout.createSequentialGroup()
- .addContainerGap()
-// .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
-// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) //, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addContainerGap());
+ if (renderHeaderPanel) {
+ headerPanel = new JPanel();
+ headerPanel.setOpaque(false);
+
+ titleLabel = new JLabel();
+ titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() |
+ java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2));
+
+ GroupLayout headerPanelLayout = new GroupLayout(headerPanel);
+ headerPanel.setLayout(headerPanelLayout);
+
+ headerPanelLayout.setHorizontalGroup(
+ headerPanelLayout.createSequentialGroup()
+ .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel));
+ headerPanelLayout.setVerticalGroup(
+ headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
+ .addComponent(helpLabel));
+ }
+
+ GroupLayout contentPanelLayout = new GroupLayout(contentPanel);
+ contentPanel.setLayout(contentPanelLayout);
+
+ GroupLayout.ParallelGroup horizontalContentInner = contentPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
+ if (renderHeaderPanel) {
+ horizontalContentInner
+ .addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE);
+ }
+ horizontalContentInner
+ .addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE);
+ GroupLayout.SequentialGroup horizontalContentOuter = contentPanelLayout.createSequentialGroup();
+ if (!renderIconPanel) {
+ horizontalContentOuter
+ .addContainerGap();
+ }
+ horizontalContentOuter
+ .addGroup(horizontalContentInner)
+ .addContainerGap();
+ contentPanelLayout.setHorizontalGroup(horizontalContentOuter);
+
+ GroupLayout.SequentialGroup verticalContent = contentPanelLayout.createSequentialGroup();
+ verticalContent.addContainerGap();
+ if (renderHeaderPanel) {
+ verticalContent.addComponent(headerPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
+ }
+ verticalContent.addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addContainerGap();
+ contentPanelLayout.setVerticalGroup(verticalContent);
}
@Override
@@ -269,26 +291,35 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-// titleLabel.setText(messages.getString(TITLE_WELCOME));
-
helpListener.setHelpTopic(HELP_WELCOME);
JLabel welcomeMsgLabel = new JLabel();
welcomeMsgLabel.setFont(welcomeMsgLabel.getFont().deriveFont(welcomeMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- welcomeMsgLabel.setText(messages.getString(TITLE_WELCOME));
-
+
+ if (renderHeaderPanel) {
+ titleLabel.setText(messages.getString(TITLE_WELCOME));
+ welcomeMsgLabel.setText(messages.getString(MESSAGE_WAIT));
+ } else {
+ welcomeMsgLabel.setText(messages.getString(TITLE_WELCOME));
+ }
+
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
- .addComponent(welcomeMsgLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
- .addComponent(helpLabel));
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(welcomeMsgLabel)
- .addComponent(helpLabel));
+ GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup()
+ .addComponent(welcomeMsgLabel);
+ GroupLayout.Group messageVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(welcomeMsgLabel);
+ if (!renderHeaderPanel) {
+ messageHorizontal
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel);
+ messageVertical
+ .addComponent(helpLabel);
+ }
+
+ mainPanelLayout.setHorizontalGroup(messageHorizontal);
+ mainPanelLayout.setVerticalGroup(messageVertical);
contentPanel.validate();
@@ -311,8 +342,10 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-// titleLabel.setText(messages.getString(TITLE_INSERTCARD));
-
+ if (renderHeaderPanel) {
+ titleLabel.setText(messages.getString(TITLE_INSERTCARD));
+ }
+
helpListener.setHelpTopic(HELP_INSERTCARD);
JLabel insertCardMsgLabel = new JLabel();
@@ -322,31 +355,39 @@ public class SimpleGUI implements BKUGUIFacade {
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
- .addComponent(insertCardMsgLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
- .addComponent(helpLabel));
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(insertCardMsgLabel)
- .addComponent(helpLabel));
+ GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup()
+ .addComponent(insertCardMsgLabel);
+ GroupLayout.ParallelGroup messageVertical = mainPanelLayout.createParallelGroup()
+ .addComponent(insertCardMsgLabel);
-// JButton cancelButton = new JButton();
-// 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));
+ if (!renderHeaderPanel) {
+ messageHorizontal
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel);
+ messageVertical
+ .addComponent(helpLabel);
+ }
+
+ mainPanelLayout.setHorizontalGroup(messageHorizontal);
+ mainPanelLayout.setVerticalGroup(messageVertical);
+
+ if (renderCancelButton) {
+ JButton cancelButton = new JButton();
+ cancelButton.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();
}
@@ -373,48 +414,89 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-// titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED));
+ JLabel insertCardMsgLabel = new JLabel();
+ insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+
+ if (renderHeaderPanel) {
+ titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED));
+ insertCardMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD));
+ } else {
+ insertCardMsgLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED));
+ }
helpListener.setHelpTopic(HELP_CARDNOTSUPPORTED);
- JLabel insertCardMsgLabel = new JLabel();
- insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- insertCardMsgLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED));
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
+
+ GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup()
+ .addComponent(insertCardMsgLabel);
+ GroupLayout.Group messageVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(insertCardMsgLabel);
+ if (!renderHeaderPanel) {
+ messageHorizontal
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel);
+ messageVertical
+ .addComponent(helpLabel);
+ }
+
+ mainPanelLayout.setHorizontalGroup(messageHorizontal);
+ mainPanelLayout.setVerticalGroup(messageVertical);
+
+ if (renderCancelButton) {
+ JButton cancelButton = new JButton();
+ cancelButton.setText(messages.getString(BUTTON_CANCEL));
+ cancelButton.addActionListener(cancelListener);
+ cancelButton.setActionCommand(cancelCommand);
- GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
- mainPanel.setLayout(mainPanelLayout);
+ GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+ buttonPanel.setLayout(buttonPanelLayout);
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
- .addComponent(insertCardMsgLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
- .addComponent(helpLabel));
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(insertCardMsgLabel)
- .addComponent(helpLabel));
-
-// JButton cancelButton = new JButton();
-// 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();
+ buttonPanelLayout.setHorizontalGroup(
+ buttonPanelLayout.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
+ buttonPanelLayout.setVerticalGroup(
+ buttonPanelLayout.createSequentialGroup()
+ .addComponent(cancelButton));
+ }
+
+ contentPanel.validate();
}
});
}
+ private static int initButtonSize(ResourceBundle messages, boolean renderCancelButton) {
+
+ int buttonSize = 0;
+
+ JButton b = new JButton();
+ b.setText(messages.getString(BUTTON_OK));
+ if (b.getPreferredSize().width > buttonSize) {
+ buttonSize = b.getPreferredSize().width;
+ }
+ b.setText(messages.getString(BUTTON_SIGN));
+ if (b.getPreferredSize().width > buttonSize) {
+ buttonSize = b.getPreferredSize().width;
+ }
+ b.setText(messages.getString(BUTTON_BACK));
+ if (b.getPreferredSize().width > buttonSize) {
+ buttonSize = b.getPreferredSize().width;
+ }
+ b.setText(messages.getString(BUTTON_SAVE));
+ if (b.getPreferredSize().width > buttonSize) {
+ buttonSize = b.getPreferredSize().width;
+ }
+ if (renderCancelButton) {
+ b.setText(messages.getString(BUTTON_CANCEL));
+ if (b.getPreferredSize().width > buttonSize) {
+ buttonSize = b.getPreferredSize().width;
+ }
+ }
+ return buttonSize;
+ }
+
private void showCardPINDialog(final PINSpec pinSpec, final int numRetries, final ActionListener okListener, final String okCommand, final ActionListener cancelListener, final String cancelCommand) {
log.debug("scheduling card-pin dialog");
@@ -429,17 +511,14 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-// if (numRetries < 0) {
-// String cardpinTitle = messages.getString(TITLE_CARDPIN);
-// titleLabel.setText(MessageFormat.format(cardpinTitle, new Object[]{pinSpec.getLocalizedName()}));
-// } else {
-// titleLabel.setText(messages.getString(TITLE_RETRY));
-// }
-
-// JButton cancelButton = new JButton();
-// cancelButton.setText(messages.getString(BUTTON_CANCEL));
-// cancelButton.setActionCommand(cancelCommand);
-// cancelButton.addActionListener(cancelListener);
+ if (renderHeaderPanel) {
+ if (numRetries < 0) {
+ String cardpinTitle = messages.getString(TITLE_CARDPIN);
+ titleLabel.setText(MessageFormat.format(cardpinTitle, new Object[]{pinSpec.getLocalizedName()}));
+ } else {
+ titleLabel.setText(messages.getString(TITLE_RETRY));
+ }
+ }
JButton okButton = new JButton();
okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD));
@@ -492,55 +571,73 @@ public class SimpleGUI implements BKUGUIFacade {
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
- .addComponent(helpLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
- .addGroup(mainPanelLayout.createSequentialGroup()
+ GroupLayout.ParallelGroup mainHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
+ GroupLayout.SequentialGroup pinHorizontal = mainPanelLayout.createSequentialGroup()
.addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //))
- .addComponent(pinsizeLabel))));
-
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createSequentialGroup()
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(infoLabel)
- .addComponent(helpLabel))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(cardPinLabel)
- .addComponent(pinField))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(pinsizeLabel));
+ .addComponent(pinsizeLabel));
+
+ GroupLayout.SequentialGroup mainVertical = mainPanelLayout.createSequentialGroup();
+
+ if (!renderHeaderPanel) {
+ GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup()
+ .addComponent(infoLabel) //, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel); //, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ mainHorizontal
+ .addGroup(infoHorizontal)
+ .addGroup(pinHorizontal);
+ GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(infoLabel)
+ .addComponent(helpLabel);
+ mainVertical
+ .addGroup(infoVertical)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED);
+ } else {
+ mainHorizontal
+ .addGroup(pinHorizontal);
+ }
+ mainVertical
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(cardPinLabel)
+ .addComponent(pinField))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(pinsizeLabel);
+
+ mainPanelLayout.setHorizontalGroup(mainHorizontal);
+ mainPanelLayout.setVerticalGroup(mainVertical);
+
+
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
- buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createSequentialGroup()
+ GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup()
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
- buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createSequentialGroup()
- .addComponent(okButton));
-
-// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
-// buttonPanel.setLayout(buttonPanelLayout);
-//
-// buttonPanelLayout.setHorizontalGroup(
-// buttonPanelLayout.createSequentialGroup()
-// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-// .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
-// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
-// .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
-// buttonPanelLayout.setVerticalGroup(
-// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
-// .addComponent(okButton)
-// .addComponent(cancelButton));
+ .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE);
+ GroupLayout.Group buttonVertical;
+
+ if (renderCancelButton) {
+ JButton cancelButton = new JButton();
+ cancelButton.setText(messages.getString(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);
+ } else {
+ buttonVertical = buttonPanelLayout.createSequentialGroup()
+ .addComponent(okButton);
+ }
+
+ buttonPanelLayout.setHorizontalGroup(buttonHorizontal);
+ buttonPanelLayout.setVerticalGroup(buttonVertical);
pinField.requestFocusInWindow();
contentPanel.validate();
@@ -583,16 +680,13 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-// if (numRetries < 0) {
-// titleLabel.setText(messages.getString(TITLE_SIGN));
-// } else {
-// titleLabel.setText(messages.getString(TITLE_RETRY));
-// }
-
-// JButton cancelButton = new JButton();
-// cancelButton.setText(messages.getString(BUTTON_CANCEL));
-// cancelButton.setActionCommand(cancelCommand);
-// cancelButton.addActionListener(cancelListener);
+ if (renderHeaderPanel) {
+ if (numRetries < 0) {
+ titleLabel.setText(messages.getString(TITLE_SIGN));
+ } else {
+ titleLabel.setText(messages.getString(TITLE_RETRY));
+ }
+ }
JButton signButton = new JButton();
signButton.setFont(signButton.getFont().deriveFont(signButton.getFont().getStyle() & ~java.awt.Font.BOLD));
@@ -653,13 +747,23 @@ public class SimpleGUI implements BKUGUIFacade {
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); //, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
+ infoVertical
+ .addComponent(helpLabel);
+ }
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
- .addComponent(helpLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+ .addGroup(infoHorizontal)
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
@@ -669,9 +773,7 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(infoLabel)
- .addComponent(helpLabel))
+ .addGroup(infoVertical)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(signPinLabel)
@@ -682,27 +784,31 @@ public class SimpleGUI implements BKUGUIFacade {
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
- buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createSequentialGroup()
+ GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup()
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(signButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
- buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createSequentialGroup()
- .addComponent(signButton));
-
-// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
-// buttonPanel.setLayout(buttonPanelLayout);
-//
-// buttonPanelLayout.setHorizontalGroup(
-// buttonPanelLayout.createSequentialGroup()
-// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-// .addComponent(signButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
-// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
-// .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
-// buttonPanelLayout.setVerticalGroup(
-// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
-// .addComponent(signButton)
-// .addComponent(cancelButton));
+ .addComponent(signButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE);
+ GroupLayout.Group buttonVertical;
+
+ if (renderCancelButton) {
+ JButton cancelButton = new JButton();
+ cancelButton.setText(messages.getString(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(signButton)
+ .addComponent(cancelButton);
+ } else {
+ buttonVertical = buttonPanelLayout.createSequentialGroup()
+ .addComponent(signButton);
+ }
+
+ buttonPanelLayout.setHorizontalGroup(buttonHorizontal);
+ buttonPanelLayout.setVerticalGroup(buttonVertical);
pinField.requestFocusInWindow();
contentPanel.validate();
@@ -726,15 +832,12 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-// titleLabel.setText(messages.getString(TITLE_ERROR));
+ if (renderHeaderPanel) {
+ titleLabel.setText(messages.getString(TITLE_ERROR));
+ }
helpListener.setHelpTopic(errorMsgKey);
- JLabel errorTitleLabel = new JLabel();
- errorTitleLabel.setFont(errorTitleLabel.getFont().deriveFont(errorTitleLabel.getFont().getStyle() | java.awt.Font.BOLD));
- errorTitleLabel.setText(messages.getString(TITLE_ERROR));
- errorTitleLabel.setForeground(ERROR_COLOR);
-
String errorMsgPattern = messages.getString(errorMsgKey);
String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams);
@@ -745,19 +848,30 @@ public class SimpleGUI implements BKUGUIFacade {
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addComponent(errorTitleLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
- .addComponent(helpLabel))
- .addComponent(errorMsgLabel));
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createSequentialGroup()
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(errorTitleLabel)
- .addComponent(helpLabel))
- .addComponent(errorMsgLabel));
+ GroupLayout.ParallelGroup mainHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
+ GroupLayout.SequentialGroup mainVertical = mainPanelLayout.createSequentialGroup();
+
+ if (!renderHeaderPanel) {
+ JLabel errorTitleLabel = new JLabel();
+ errorTitleLabel.setFont(errorTitleLabel.getFont().deriveFont(errorTitleLabel.getFont().getStyle() | java.awt.Font.BOLD));
+ errorTitleLabel.setText(messages.getString(TITLE_ERROR));
+ errorTitleLabel.setForeground(ERROR_COLOR);
+
+ mainHorizontal
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addComponent(errorTitleLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel));
+ mainVertical
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(errorTitleLabel)
+ .addComponent(helpLabel));
+ }
+
+ mainPanelLayout.setHorizontalGroup(mainHorizontal
+ .addComponent(errorMsgLabel));
+ mainPanelLayout.setVerticalGroup(mainVertical
+ .addComponent(errorMsgLabel));
JButton okButton = new JButton();
okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD));
@@ -796,15 +910,12 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-// titleLabel.setText(messages.getString(TITLE_ERROR));
+ if (renderHeaderPanel) {
+ titleLabel.setText(messages.getString(TITLE_ERROR));
+ }
helpListener.setHelpTopic(errorMsgKey);
- JLabel errorTitleLabel = new JLabel();
- errorTitleLabel.setFont(errorTitleLabel.getFont().deriveFont(errorTitleLabel.getFont().getStyle() | java.awt.Font.BOLD));
- errorTitleLabel.setText(messages.getString(TITLE_ERROR));
- errorTitleLabel.setForeground(ERROR_COLOR);
-
String errorMsgPattern = messages.getString(errorMsgKey);
String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams);
@@ -815,20 +926,32 @@ public class SimpleGUI implements BKUGUIFacade {
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+
+ GroupLayout.ParallelGroup mainHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
+ GroupLayout.SequentialGroup mainVertical = mainPanelLayout.createSequentialGroup();
+
+ if (!renderHeaderPanel) {
+ JLabel errorTitleLabel = new JLabel();
+ errorTitleLabel.setFont(errorTitleLabel.getFont().deriveFont(errorTitleLabel.getFont().getStyle() | java.awt.Font.BOLD));
+ errorTitleLabel.setText(messages.getString(TITLE_ERROR));
+ errorTitleLabel.setForeground(ERROR_COLOR);
+
+ mainHorizontal
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(errorTitleLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
- .addComponent(helpLabel))
- .addComponent(errorMsgLabel));
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createSequentialGroup()
+ .addComponent(helpLabel));
+ mainVertical
.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(errorTitleLabel)
- .addComponent(helpLabel))
- .addComponent(errorMsgLabel));
+ .addComponent(helpLabel));
+ }
+ mainPanelLayout.setHorizontalGroup(mainHorizontal
+ .addComponent(errorMsgLabel));
+ mainPanelLayout.setVerticalGroup(mainVertical
+ .addComponent(errorMsgLabel));
+
contentPanel.validate();
}
});
@@ -849,8 +972,10 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-// titleLabel.setText(messages.getString(TITLE_WAIT));
-
+ if (renderHeaderPanel) {
+ titleLabel.setText(messages.getString(TITLE_WAIT));
+ }
+
helpListener.setHelpTopic(HELP_WAIT);
JLabel waitMsgLabel = new JLabel();
@@ -864,15 +989,20 @@ public class SimpleGUI implements BKUGUIFacade {
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
- .addComponent(waitMsgLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
- .addComponent(helpLabel));
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(waitMsgLabel)
- .addComponent(helpLabel));
+ GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup()
+ .addComponent(waitMsgLabel);
+ GroupLayout.ParallelGroup messageVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(waitMsgLabel);
+
+ if (!renderHeaderPanel) {
+ messageHorizontal
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel);
+ messageVertical
+ .addComponent(helpLabel);
+ }
+ mainPanelLayout.setHorizontalGroup(messageHorizontal);
+ mainPanelLayout.setVerticalGroup(messageVertical);
contentPanel.validate();
}
@@ -887,50 +1017,58 @@ public class SimpleGUI implements BKUGUIFacade {
return null;
}
+ /**
+ * TODO handle multiple references in HashDataViewer
+ * @param signedReferences
+ * @param okListener
+ * @param okCommand
+ */
@Override
- public void showHashDataInputDialog(final List signedReferences, boolean standalone, final ActionListener okListener, final String okCommand) {
+ public void showHashDataInputDialog(final List signedReferences, final ActionListener okListener, final String okCommand) {
if (signedReferences == null) {
showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {"No SignedReferences provided"}, okListener, okCommand);
+ return;
}
+ ActionListener saveHashDataListener = new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ showSaveHashDataInputDialog(signedReferences, okListener, okCommand);
+ }
+ };
+
if (signedReferences.size() == 1) {
- if (standalone) {
- ActionListener saveHashDataListener = new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- showSaveHashDataInputDialog(signedReferences, okListener, okCommand);
- }
- };
- showHashDataViewer(signedReferences, saveHashDataListener, "save");
+// if (standalone) {
- } else {
- if ("text/plain".equals(signedReferences.get(0).getMimeType())) {
-
- ActionListener saveHashDataListener = new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- showSaveHashDataInputDialog(signedReferences, okListener, okCommand);
- }
- };
-
- try {
- String hashDataText = getText(signedReferences.get(0));
- showPlainTextHashDataInputDialog(hashDataText, saveHashDataListener, "save", okListener, okCommand);
- } catch (IOException ex) {
- showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {ex.getMessage()}, okListener, okCommand);
- }
+ showHashDataViewer(signedReferences, saveHashDataListener, "save");
- } else {
- showSaveHashDataInputDialog(signedReferences, okListener, okCommand);
- }
- }
+// } else {
+// if ("text/plain".equals(signedReferences.get(0).getMimeType())) {
+//
+// ActionListener saveHashDataListener = new ActionListener() {
+//
+// @Override
+// public void actionPerformed(ActionEvent e) {
+// showSaveHashDataInputDialog(signedReferences, okListener, okCommand);
+// }
+// };
+//
+// try {
+// String hashDataText = getText(signedReferences.get(0));
+// showPlainTextHashDataInputDialog(hashDataText, saveHashDataListener, "save", okListener, okCommand);
+// } catch (IOException ex) {
+// showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {ex.getMessage()}, okListener, okCommand);
+// }
+//
+// } else {
+// showSaveHashDataInputDialog(signedReferences, okListener, okCommand);
+// }
+// }
} else {
- SimpleHashDataTableModel tableModel = new SimpleHashDataTableModel(signedReferences);
// final HashDataTableModel tableModel = new HashDataTableModel(signedReferences);
//
// ActionListener saveHashDataListener = new ActionListener() {
@@ -940,128 +1078,112 @@ public class SimpleGUI implements BKUGUIFacade {
// showSaveHashDataInputDialog(tableModel.getSelectedHashData(), okListener, okCommand);
// }
// };
- showMultipleHashDataInputDialog(tableModel, okListener, okCommand);
+
+ SimpleHashDataTableModel tableModel = new SimpleHashDataTableModel(signedReferences);
+ showMultipleHashDataInputDialog(tableModel, okListener, okCommand, saveHashDataListener, "save");
}
}
/**
- * TODO
+ * blocks until dialog returns (is closed)
* @param hashDataText
* @param saveListener
* @param saveCommand
*/
private void showHashDataViewer(final List signedReferences, final ActionListener saveListener, final String saveCommand) {
- log.debug("scheduling plaintext hashdatainput dialog");
-
- SwingUtilities.invokeLater(new Runnable() {
-
- @Override
- public void run() {
-
- log.debug("show plaintext hashdatainput dialog");
-
- ActionListener l = helpListener.getActionListener();
- HashDataViewer.showHashDataInput(contentPane, signedReferences, messages, saveListener, saveCommand, l);
- }
- });
- }
-
- private void showPlainTextHashDataInputDialog(final String hashDataText, final ActionListener saveListener, final String saveCommand, final ActionListener cancelListener, final String cancelCommand) {
-
- log.debug("scheduling plaintext hashdatainput dialog");
- SwingUtilities.invokeLater(new Runnable() {
-
- @Override
- public void run() {
-
- log.debug("show plaintext hashdatainput dialog");
-
- mainPanel.removeAll();
- buttonPanel.removeAll();
-
-// titleLabel.setText(messages.getString(TITLE_HASHDATA));
-
- helpListener.setHelpTopic(HELP_HASHDATA);
-
- JLabel refIdLabel = new JLabel();
- refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- refIdLabel.setText(messages.getString(MESSAGE_HASHDATA)); //MessageFormat.format(refIdLabelPattern, new Object[]{refId}));
-
- JTextArea hashDataTextArea = new JTextArea(hashDataText);
- hashDataTextArea.setEditable(false);
-// hashDataTextArea.setColumns(1);
-// hashDataTextArea.setRows(1);
- hashDataTextArea.setFont(new Font(HASHDATA_FONT, hashDataTextArea.getFont().getStyle(), hashDataTextArea.getFont().getSize()));
-// hashDataScrollPane.setViewportView(hashDataTextArea);
-// hashDataScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); //HORIZONTAL_SCROLLBAR_NEVER);
- hashDataTextArea.setLineWrap(true);
- hashDataTextArea.setWrapStyleWord(true);
-
- JScrollPane hashDataScrollPane = new JScrollPane(hashDataTextArea);
-
- GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
- mainPanel.setLayout(mainPanelLayout);
-
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addComponent(refIdLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
- .addComponent(helpLabel))
- .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
-
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createSequentialGroup()
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(refIdLabel)
- .addComponent(helpLabel))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
-
- JButton backButton = new JButton();
- backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD));
- backButton.setText(messages.getString(BUTTON_BACK));
- backButton.setActionCommand(cancelCommand);
- backButton.addActionListener(cancelListener);
+ try {
+ log.debug("scheduling plaintext hashdatainput dialog");
-// JButton saveButton = new JButton();
-// saveButton.setText(messages.getString(BUTTON_SAVE));
-// saveButton.setActionCommand(saveCommand);
-// saveButton.addActionListener(saveListener);
+ SwingUtilities.invokeAndWait(new Runnable() {
- GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
- buttonPanel.setLayout(buttonPanelLayout);
+ @Override
+ public void run() {
- buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createSequentialGroup()
- .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
- buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createSequentialGroup()
- .addComponent(backButton));
+ log.debug("show plaintext hashdatainput dialog");
+ ActionListener l = helpListener.getActionListener();
+ HashDataViewer.showHashDataInput(contentPane, signedReferences, messages, saveListener, saveCommand, l);
+ }
+ });
+
+ } catch (InterruptedException ex) {
+ log.error("Failed to display HashDataViewer: " + ex.getMessage());
+ } catch (InvocationTargetException ex) {
+ log.error("Failed to display HashDataViewer: " + ex.getMessage());
+ }
+ }
+
+// private void showPlainTextHashDataInputDialog(final String hashDataText, final ActionListener saveListener, final String saveCommand, final ActionListener cancelListener, final String cancelCommand) {
+//
+// log.debug("scheduling plaintext hashdatainput dialog");
+//
+// SwingUtilities.invokeLater(new Runnable() {
+//
+// @Override
+// public void run() {
+//
+// log.debug("show plaintext hashdatainput dialog");
+//
+// mainPanel.removeAll();
+// buttonPanel.removeAll();
+//
+// helpListener.setHelpTopic(HELP_HASHDATA);
+//
+// JLabel refIdLabel = new JLabel();
+// refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+// refIdLabel.setText(messages.getString(MESSAGE_HASHDATA)); //MessageFormat.format(refIdLabelPattern, new Object[]{refId}));
+//
+// JTextArea hashDataTextArea = new JTextArea(hashDataText);
+// hashDataTextArea.setEditable(false);
+// hashDataTextArea.setFont(new Font(HASHDATA_FONT, hashDataTextArea.getFont().getStyle(), hashDataTextArea.getFont().getSize()));
+// hashDataTextArea.setLineWrap(true);
+// hashDataTextArea.setWrapStyleWord(true);
+//
+// JScrollPane hashDataScrollPane = new JScrollPane(hashDataTextArea);
+//
+// GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+// mainPanel.setLayout(mainPanelLayout);
+//
+// mainPanelLayout.setHorizontalGroup(
+// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addGroup(mainPanelLayout.createSequentialGroup()
+// .addComponent(refIdLabel)
+// .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+// .addComponent(helpLabel))
+// .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
+//
+// mainPanelLayout.setVerticalGroup(
+// mainPanelLayout.createSequentialGroup()
+// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+// .addComponent(refIdLabel)
+// .addComponent(helpLabel))
+// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+// .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
+//
+// JButton backButton = new JButton();
+// backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD));
+// backButton.setText(messages.getString(BUTTON_BACK));
+// backButton.setActionCommand(cancelCommand);
+// backButton.addActionListener(cancelListener);
+//
// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
// buttonPanel.setLayout(buttonPanelLayout);
//
// buttonPanelLayout.setHorizontalGroup(
// buttonPanelLayout.createSequentialGroup()
// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-// .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
-// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
// .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
// buttonPanelLayout.setVerticalGroup(
-// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
-// .addComponent(saveButton)
-// .addComponent(backButton));
-
- contentPanel.validate();
- }
- });
- }
+// buttonPanelLayout.createSequentialGroup()
+// .addComponent(backButton));
+//
+// contentPanel.validate();
+// }
+// });
+// }
- private void showMultipleHashDataInputDialog(final TableModel signedReferences, final ActionListener cancelListener, final String cancelCommand) {
-// , final ActionListener saveListener, final String saveCommand
+ private void showMultipleHashDataInputDialog(final TableModel signedReferences, final ActionListener cancelListener, final String cancelCommand, final ActionListener saveListener, final String saveCommand) {
log.debug("scheduling multiple hashdatainput dialog");
@@ -1075,8 +1197,10 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-// titleLabel.setText(messages.getString(TITLE_HASHDATA));
-
+ if (renderHeaderPanel) {
+ titleLabel.setText(messages.getString(TITLE_HASHDATA));
+ }
+
helpListener.setHelpTopic(HELP_HASHDATALIST);
JLabel refIdLabel = new JLabel();
@@ -1124,36 +1248,31 @@ public class SimpleGUI implements BKUGUIFacade {
backButton.setActionCommand(cancelCommand);
backButton.addActionListener(cancelListener);
-// JButton saveButton = new JButton();
-// saveButton.setText(messages.getString(BUTTON_SAVE));
-// saveButton.setActionCommand(saveCommand);
-// saveButton.addActionListener(saveListener);
-
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
- buttonPanelLayout.setHorizontalGroup(
- buttonPanelLayout.createSequentialGroup()
+ GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup()
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
- buttonPanelLayout.setVerticalGroup(
- buttonPanelLayout.createSequentialGroup()
- .addComponent(backButton));
-
-
-// GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
-// buttonPanel.setLayout(buttonPanelLayout);
-//
-// buttonPanelLayout.setHorizontalGroup(
-// buttonPanelLayout.createSequentialGroup()
-// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-// .addComponent(saveButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
-// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
-// .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
-// buttonPanelLayout.setVerticalGroup(
-// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
-// .addComponent(saveButton)
-// .addComponent(backButton));
+ .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE);
+ GroupLayout.ParallelGroup buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(backButton);
+
+ if (renderCancelButton) {
+ //render save button
+ JButton saveButton = new JButton();
+ saveButton.setText(messages.getString(BUTTON_SAVE));
+ saveButton.setActionCommand(saveCommand);
+ saveButton.addActionListener(saveListener);
+
+ buttonHorizontal
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE);
+ buttonVertical
+ .addComponent(saveButton);
+ }
+
+ buttonPanelLayout.setHorizontalGroup(buttonHorizontal);
+ buttonPanelLayout.setVerticalGroup(buttonVertical);
contentPanel.validate();
}
@@ -1243,36 +1362,36 @@ public class SimpleGUI implements BKUGUIFacade {
});
}
- private static String getText(HashDataInput hdi) throws IOException {
- ByteArrayOutputStream baos = null;
- try {
- InputStream hashDataIS = hdi.getHashDataInput();
- if (hashDataIS == null) {
- log.error("No HashDataInput stream for reference " + hdi.getReferenceId());
- return null;
- } else {
- baos = new ByteArrayOutputStream(hashDataIS.available());
- int c;
- while ((c = hashDataIS.read()) != -1) {
- baos.write(c);
- }
- String encoding = hdi.getEncoding();
- if (encoding == null) {
- //default for URL-encoded
- encoding = "UTF-8";
- }
- return baos.toString(encoding);
- }
- } catch (IOException ex) {
- log.error("Failed to read HashDataInput for reference " + hdi.getReferenceId() + ": " + ex.getMessage());
- throw ex;
- } finally {
- try {
- baos.close();
- } catch (IOException ex) {
- }
- }
- }
+// private static String getText(HashDataInput hdi) throws IOException {
+// ByteArrayOutputStream baos = null;
+// try {
+// InputStream hashDataIS = hdi.getHashDataInput();
+// if (hashDataIS == null) {
+// log.error("No HashDataInput stream for reference " + hdi.getReferenceId());
+// return null;
+// } else {
+// baos = new ByteArrayOutputStream(hashDataIS.available());
+// int c;
+// while ((c = hashDataIS.read()) != -1) {
+// baos.write(c);
+// }
+// String encoding = hdi.getEncoding();
+// if (encoding == null) {
+// //default for URL-encoded
+// encoding = "UTF-8";
+// }
+// return baos.toString(encoding);
+// }
+// } catch (IOException ex) {
+// log.error("Failed to read HashDataInput for reference " + hdi.getReferenceId() + ": " + ex.getMessage());
+// throw ex;
+// } finally {
+// try {
+// baos.close();
+// } catch (IOException ex) {
+// }
+// }
+// }
private void registerHelpListener(ActionListener helpListener) {
if (helpListener != null) {
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index 5f62c05a..b5a74ac1 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -14,7 +14,7 @@
# limitations under the License.
title.welcome=Willkommen
-title.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken
+title.insertcard=Keine B\u00FCrgerkarte gefunden
title.cardnotsupported=Die Karte wird nicht unterst\u00FCtzt
title.cardpin={0} eingeben
title.sign=Signatur erstellen
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
index d963fd5f..94464982 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
@@ -14,7 +14,7 @@
# limitations under the License.
title.welcome=Welcome
-title.insertcard=Please insert your citizen-card into the reader
+title.insertcard=No citizen-card found
title.cardnotsupported=This card is not supported
title.cardpin=Enter {0}
title.sign=Create signature
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
index c32a237a..b57e1923 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
@@ -32,15 +32,16 @@ import org.junit.Test;
*
* @author clemens
*/
+@Ignore
public class BKUGUITest {
- @Ignore
+ @Test
public void testBKUGUI() {
JFrame testFrame = new JFrame("BKUGUITest");
BKUGUI gui = new BKUGUI();
Container contentPane = testFrame.getContentPane();
contentPane.setPreferredSize(new Dimension(380, 150));
- gui.init(contentPane, null, null, null);
+ gui.init(contentPane, null, BKUGUIFacade.Style.advanced, null, null);
BKUGUIWorker worker = new BKUGUIWorker();
worker.init(gui);
testFrame.pack();
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index af1368e5..e4936067 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -43,7 +43,7 @@ public class BKUGUIWorker implements Runnable {
@Override
public void run() {
- try {
+// try {
final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN");
@@ -176,7 +176,7 @@ public class BKUGUIWorker implements Runnable {
// signedRefs.add(signedRef4);
// signedRefs.add(signedRef4);
// signedRefs = Collections.singletonList(signedRef1);
- gui.showHashDataInputDialog(signedRefs, true, returnListener, "return");
+ gui.showHashDataInputDialog(signedRefs, returnListener, "return");
}
};
@@ -184,64 +184,64 @@ public class BKUGUIWorker implements Runnable {
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.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);
+// 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.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.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();
- }
+// } catch (InterruptedException ex) {
+// ex.printStackTrace();
+// }
}
}
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
index fb8f2432..eaa4d6ad 100644
--- 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
@@ -37,10 +37,10 @@ public class BKUGuiProxy implements BKUGUIFacade {
return delegate.getPin();
}
- @Override
- public void init(Container contentPane, Locale locale, URL bgImage, ActionListener helpListener) {
- delegate.init(contentPane, locale, bgImage, helpListener);
- }
+// @Override
+// public void init(Container contentPane, Locale locale, URL bgImage, ActionListener helpListener) {
+// delegate.init(contentPane, locale, bgImage, helpListener);
+// }
@Override
public Locale getLocale() {
@@ -126,11 +126,9 @@ public class BKUGuiProxy implements BKUGUIFacade {
@Override
public void showHashDataInputDialog(List signedReferences,
- boolean externalDisplay,
ActionListener okListener,
String okCommand) {
showDialog();
- delegate.showHashDataInputDialog(signedReferences, externalDisplay, okListener,
- okCommand);
+ delegate.showHashDataInputDialog(signedReferences, okListener, okCommand);
}
}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java
index 19e6a657..bfce0f0d 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalSignRequestHandler.java
@@ -109,7 +109,7 @@ public class LocalSignRequestHandler extends SignRequestHandler {
log.error("dsig:SignedInfo does not contain a data reference");
throw new Exception("dsig:SignedInfo does not contain a data reference");
}
- gui.showHashDataInputDialog(selectedHashDataInputs, false, this, "ok");
+ gui.showHashDataInputDialog(selectedHashDataInputs, this, "ok");
}
private ByteArrayHashDataInput getByteArrayHashDataInput(HashDataInput hashDataInput) throws IOException {
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java
index cad8cfb6..7012fec0 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/SMCCSTALFactory.java
@@ -48,7 +48,6 @@ public class SMCCSTALFactory implements STALFactory {
if (locale != null) {
dialog.setLocale(locale);
}
- BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI);
DefaultHelpListener helpListener = null;
try {
if (helpURL != null) {
@@ -60,7 +59,11 @@ public class SMCCSTALFactory implements STALFactory {
} catch (MalformedURLException ex) {
log.error("failed to configure help listener: " + ex.getMessage(), ex);
}
- gui.init(dialog.getContentPane(), dialog.getLocale(), null, helpListener);
+ BKUGUIFacade gui = BKUGUIFactory.createGUI(dialog.getContentPane(),
+ dialog.getLocale(),
+ BKUGUIFactory.ADVANCED_GUI,
+ null,
+ helpListener);
stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog);
dialog.setPreferredSize(new Dimension(400, 200));
dialog.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
diff --git a/BKUOnline/src/main/webapp/HTTP-ohne.html b/BKUOnline/src/main/webapp/HTTP-ohne.html
index 112a1d92..607fa5d4 100644
--- a/BKUOnline/src/main/webapp/HTTP-ohne.html
+++ b/BKUOnline/src/main/webapp/HTTP-ohne.html
@@ -101,7 +101,7 @@ legend {
HashData Display
Frame
Browser
- Applet
+
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 9d23315c..38247174 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
@@ -38,6 +38,8 @@ import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
+import java.util.logging.Level;
+import java.util.logging.Logger;
import javax.swing.CellRendererPane;
import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
@@ -50,8 +52,12 @@ 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 javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -1013,80 +1019,75 @@ public class BKUGUIImpl implements BKUGUIFacade {
}
if (signedReferences.size() == 1) {
- ActionListener saveHashDataListener = new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- HashDataInput hdi = signedReferences.get(0);
- showSaveHashDataInputDialog(Collections.singletonList(hdi), okListener, okCommand);
- }
- };
- showHashDataViewer(signedReferences.get(0), saveHashDataListener, "save");
+ try {
+ log.debug("scheduling hashdata viewer");
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ ActionListener saveHashDataListener = new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ HashDataInput hdi = signedReferences.get(0);
+ showSaveHashDataInputDialog(Collections.singletonList(hdi), okListener, okCommand);
+ }
+ };
+ showHashDataViewer(signedReferences.get(0), saveHashDataListener, "save");
+ }
+ });
+
+ } catch (InterruptedException ex) {
+ log.error("Failed to display HashDataViewer: " + ex.getMessage());
+ } catch (InvocationTargetException ex) {
+ log.error("Failed to display HashDataViewer: " + ex.getMessage());
+ }
} else {
- HashDataTableModel tableModel = new HashDataTableModel(signedReferences);
- showSignedReferencesListDialog(tableModel, okListener, okCommand);
+ showSignedReferencesListDialog(signedReferences, okListener, okCommand);
}
}
/**
* Opens HashDataViewer on mouse clicked event
*/
- public class HashDataMouseListener extends MouseAdapter {
-
- private HashDataInput hashData;
-
- public void setHashData(HashDataInput hashData) {
- this.hashData = hashData;
- }
-
- @Override
- public void mouseClicked(MouseEvent e) {
- ActionListener saveListener = new ActionListener() {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- showSaveHashDataInputDialog(Collections.singletonList(hashData), null, null);
- }
- };
- showHashDataViewer(hashData, saveListener, "save");
- super.mouseClicked(e);
- }
-
-
-
- }
+// public class HashDataMouseListener extends MouseAdapter {
+//
+// private HashDataInput hashData;
+//
+// public void setHashData(HashDataInput hashData) {
+// this.hashData = hashData;
+// }
+//
+// @Override
+// public void mouseClicked(MouseEvent e) {
+// ActionListener saveListener = new ActionListener() {
+//
+// @Override
+// public void actionPerformed(ActionEvent e) {
+// showSaveHashDataInputDialog(Collections.singletonList(hashData), null, null);
+// }
+// };
+// showHashDataViewer(hashData, saveListener, "save");
+// super.mouseClicked(e);
+// }
+// }
/**
- * blocks until dialog returns (is closed)
+ * has to be called from event dispatcher thread
* @param hashDataText
* @param saveListener
* @param saveCommand
*/
private void showHashDataViewer(final HashDataInput hashDataInput, final ActionListener saveListener, final String saveCommand) {
- try {
- log.debug("scheduling plaintext hashdatainput dialog");
-
- // avoid double-clicks on hashdata link
- SwingUtilities.invokeAndWait(new Runnable() {
-
- @Override
- public void run() {
-
- log.debug("show plaintext hashdatainput dialog");
+ log.debug("show hashdata viewer");
- ActionListener l = helpListener.getActionListener();
- HashDataViewer.showHashDataInput(contentPane, hashDataInput, messages, saveListener, saveCommand, l);
- }
- });
-
- } catch (InterruptedException ex) {
- log.error("Failed to display HashDataViewer: " + ex.getMessage());
- } catch (InvocationTargetException ex) {
- log.error("Failed to display HashDataViewer: " + ex.getMessage());
- }
+ ActionListener l = helpListener.getActionListener();
+ HashDataViewer.showHashDataInput(contentPane, hashDataInput, messages, saveListener, saveCommand, l);
}
- private void showSignedReferencesListDialog(final HashDataTableModel signedReferences, final ActionListener backListener, final String backCommand) {
+ private void showSignedReferencesListDialog(final List signedReferences, final ActionListener backListener, final String backCommand) {
log.debug("scheduling signed references list dialog");
@@ -1109,21 +1110,40 @@ public class BKUGUIImpl implements BKUGUIFacade {
JLabel refIdLabel = new JLabel();
refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
String refIdLabelPattern = messages.getString(MESSAGE_HASHDATALIST);
- refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.getRowCount()}));
+ refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.size()}));
- JTable hashDataTable = new JTable(signedReferences);
- hashDataTable.setDefaultRenderer(HashDataInput.class, signedReferences.getRenderer());
-
+ HashDataTableModel tableModel = new HashDataTableModel(signedReferences);
+ JTable hashDataTable = new JTable(tableModel);
+// hashDataTable.setDefaultRenderer(HashDataInput.class, signedReferences.getRenderer());
hashDataTable.setTableHeader(null);
- // hashDataTable.setShowVerticalLines(false);
- hashDataTable.setRowSelectionAllowed(true);
-// TableColumn selectCol = hashDataTable.getColumnModel().getColumn(1);
-// selectCol.setMinWidth(CHECKBOX_WIDTH);
-// selectCol.setMaxWidth(CHECKBOX_WIDTH);
+
+ hashDataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+ hashDataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+ @Override
+ public void valueChanged(final ListSelectionEvent e) {
+ //invoke later to allow thread to paint selection background
+ SwingUtilities.invokeLater(new Runnable() {
-// hashDataTable.setPreferredScrollableViewportSize(mainPanel.getPreferredSize());
+ @Override
+ public void run() {
+ ListSelectionModel lsm = (ListSelectionModel) e.getSource();
+ int selectionIdx = lsm.getMinSelectionIndex();
+ if (selectionIdx >= 0) {
+ final HashDataInput selection = signedReferences.get(selectionIdx);
+ showHashDataViewer(selection, new ActionListener() {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ showSaveHashDataInputDialog(Collections.singletonList(selection), null, null);
+ }
+ }, "save");
+ }
+ }
+ });
+ }
+ });
+
JScrollPane hashDataScrollPane = new JScrollPane(hashDataTable);
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
@@ -1174,6 +1194,12 @@ public class BKUGUIImpl implements BKUGUIFacade {
});
}
+ /**
+ *
+ * @param signedRefs
+ * @param okListener may be null
+ * @param okCommand
+ */
private void showSaveHashDataInputDialog(final List signedRefs, final ActionListener okListener, final String okCommand) {
log.debug("scheduling save hashdatainput dialog");
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
index a6709860..9a43e99d 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
@@ -17,21 +17,8 @@
package at.gv.egiz.bku.gui;
import at.gv.egiz.stal.HashDataInput;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Cursor;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
import java.util.List;
-import javax.swing.JDialog;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;
-import javax.swing.table.TableCellRenderer;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -43,17 +30,15 @@ class HashDataTableModel extends DefaultTableModel {
protected static final Log log = LogFactory.getLog(HashDataTableModel.class);
- protected Class[] types = new Class[]{HashDataInput.class};
+ protected Class[] types = new Class[]{ String.class, String.class };
protected List hashDataInputs;
- private HashDataLinkRenderer renderer;
public HashDataTableModel(List hashDataInputs) {
- super(0, 1);
+ super(0, 2);
this.hashDataInputs = hashDataInputs;
for (HashDataInput hdi : hashDataInputs) {
- addRow(new Object[]{hdi});
+ addRow(new Object[]{hdi.getReferenceId(), hdi.getMimeType()});
}
- this.renderer = new HashDataLinkRenderer();
}
@Override
@@ -66,46 +51,45 @@ class HashDataTableModel extends DefaultTableModel {
return false;
}
-
-
- public HashDataLinkRenderer getRenderer() {
- return renderer;
- }
+// public HashDataInput getValue(int rowIndex) {
+// return hashDataInputs.get(rowIndex);
+// }
+//
- public class HashDataLinkRenderer extends JLabel
- implements TableCellRenderer {
-// extends DefaultTableCellRenderer {
-
-// protected ActionListener saveHashDataListener;
+// public class HashDataLinkRenderer extends JLabel
+// implements TableCellRenderer {
+//// extends DefaultTableCellRenderer {
+//
+//// protected ActionListener saveHashDataListener;
+////
+//// public HashDataLinkRenderer(ActionListener saveHashDataListener) {
+//// this.saveHashDataListener = saveHashDataListener;
+//// }
+//
+// @Override
+// public Component getTableCellRendererComponent(JTable table,
+// Object value,
+// boolean isSelected,
+// boolean hasFocus,
+// final int row,
+// int column) {
+// final HashDataInput hdi = (HashDataInput) value;
+// log.debug("render hashdatainput " + hdi.getReferenceId() + " - (" + row + "," + column + ") " + isSelected + hasFocus);
+// setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+// setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD));
+// setText(hdi.getReferenceId() + " (" + hdi.getMimeType() + ")");
+// addMouseListener(new MouseAdapter() {
+//
+// @Override
+// public void mouseClicked(MouseEvent e) {
+// log.debug("received mouseclick on " + hdi.getReferenceId());
+//// saveHashDataListener.actionPerformed();
+// JOptionPane.showInputDialog(hashDataInputs.get(row).getReferenceId());
+// }
+//
+// });
//
-// public HashDataLinkRenderer(ActionListener saveHashDataListener) {
-// this.saveHashDataListener = saveHashDataListener;
+// return this;
// }
-
- @Override
- public Component getTableCellRendererComponent(JTable table,
- Object value,
- boolean isSelected,
- boolean hasFocus,
- final int row,
- int column) {
- final HashDataInput hdi = (HashDataInput) value;
- log.debug("render hashdatainput " + hdi.getReferenceId() + " - (" + row + "," + column + ") " + isSelected + hasFocus);
- setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
- setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD));
- setText(hdi.getReferenceId() + " (" + hdi.getMimeType() + ")");
- addMouseListener(new MouseAdapter() {
-
- @Override
- public void mouseClicked(MouseEvent e) {
- log.debug("received mouseclick on " + hdi.getReferenceId());
-// saveHashDataListener.actionPerformed();
- JOptionPane.showInputDialog(hashDataInputs.get(row).getReferenceId());
- }
-
- });
-
- return this;
- }
- }
+// }
}
\ No newline at end of file
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
index db66bd52..263c3c04 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
@@ -16,6 +16,7 @@
*/
package at.gv.egiz.bku.gui;
+import at.gv.egiz.bku.gui.html.RestrictedHTMLEditorKit;
import at.gv.egiz.stal.HashDataInput;
import java.awt.Component;
import java.awt.Container;
@@ -45,6 +46,7 @@ import javax.swing.JScrollPane;
import javax.swing.LayoutStyle;
import javax.swing.text.Document;
import javax.swing.text.EditorKit;
+import javax.swing.text.StyledEditorKit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -182,9 +184,11 @@ public class HashDataViewer extends JDialog
JEditorPane viewer = new JEditorPane();
if ("text/plain".equals(mimeType)) {
+ //line wrapping, etc.
+ viewer.setEditorKit(new StyledEditorKit());
viewer.setFont(new Font(PLAINTEXT_FONT, viewer.getFont().getStyle(), viewer.getFont().getSize()));
// } else if ("text/html".equals(mimeType)) {
-// viewer.setEditorKitForContentType("text/html", new RestrictedHTMLEditorKit());
+// viewer.setEditorKit(new RestrictedHTMLEditorKit());
}
viewer.setEditable(false);
viewer.setContentType(mimeType);
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index 82b42d0f..fec097f5 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -81,7 +81,7 @@ public class BKUGUIWorker implements Runnable {
};
HashDataInput signedRef1 = new ByteArrayHashDataInput(
"Ich bin ein einfacher Text mit Umlauten: öäüßéç@€\n123\n456\n\tHello, world!\n\nlkjsd\nnksdjf".getBytes(),
- "ref-id-000000001",
+ "ref-id-0000000000000000000000001",
"text/plain",
"UTF-8");
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
index 26905f50..d041a8cb 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
@@ -48,7 +48,6 @@ import at.gv.egiz.stal.SignResponse;
import at.gv.egiz.stal.signedinfo.ObjectFactory;
import at.gv.egiz.stal.signedinfo.SignedInfoType;
import at.gv.egiz.stal.util.JCEAlgorithmNames;
-import java.awt.event.ActionListener;
import java.security.DigestException;
import java.util.List;
@@ -128,9 +127,6 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen
return true;
}
-// @Override
-// public String providePIN(PINSpec spec, int retries) {
-
class STALPinProvider implements PINProvider {
protected SignedInfoType signedInfo;
@@ -178,7 +174,7 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen
} else if (actionCommand.equals("sign")) {
retryCounter++;
return new String(gui.getPin());
- } else if (actionCommand.equals("ok")) {
+ } else if (actionCommand.equals("hashDataDone")) {
showSignaturePINDialog(spec, retries);
} else if (actionCommand.equals("error")) {
return null;
--
cgit v1.2.3
From b93f035e2c9df0ad430300c4f755b775a4aa1ed3 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Mon, 24 Nov 2008 13:37:11 +0000
Subject: xhtml warning
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@192 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 3 +-
.../main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 15 +++--
.../java/at/gv/egiz/bku/gui/HashDataViewer.java | 72 +++++++++++-----------
.../at/gv/egiz/bku/gui/Messages.properties | 3 +-
.../at/gv/egiz/bku/gui/Messages_en.properties | 3 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 6 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 5 +-
7 files changed, 59 insertions(+), 48 deletions(-)
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index 7d912f11..d3cb76f2 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -62,11 +62,12 @@ public interface BKUGUIFacade {
public static final String MESSAGE_INSERTCARD = "message.insertcard";
public static final String MESSAGE_ENTERPIN = "message.enterpin";
public static final String MESSAGE_HASHDATALINK = "message.hashdatalink";
- public static final String MESSAGE_HASHDATA = "message.hashdata";
+// public static final String MESSAGE_HASHDATA = "message.hashdata";
public static final String MESSAGE_HASHDATALIST = "message.hashdatalist";
public static final String MESSAGE_RETRIES = "message.retries";
public static final String MESSAGE_OVERWRITE = "message.overwrite";
public static final String MESSAGE_HELP = "message.help";
+ public static final String WARNING_XHTML = "warning.xhtml";
public static final String LABEL_PIN = "label.pin";
public static final String LABEL_PINSIZE = "label.pinsize";
public static final String HELP_WELCOME = "help.welcome";
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 a190b9c0..c786a291 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
@@ -208,13 +208,16 @@ public class BKUGUIImpl implements BKUGUIFacade {
if (background == null) {
background = getClass().getResource(DEFAULT_BACKGROUND);
}
- if ("file".equals(background.getProtocol())) {
- log.warn("file:// background images not permitted: " + background);
- background = getClass().getResource(DEFAULT_BACKGROUND);
+ if (background == null) {
+ contentPanel = new JPanel();
+ } else {
+ if ("file".equals(background.getProtocol())) {
+ log.warn("file:// background images not permitted: " + background);
+ background = getClass().getResource(DEFAULT_BACKGROUND);
+ }
+ log.debug("loading background " + background);
+ contentPanel = new ImagePanel(background);
}
- log.debug("loading background " + background);
- contentPanel = new ImagePanel(background);
-
mainPanel = new JPanel();
mainPanel.setOpaque(false);
buttonPanel = new JPanel();
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
index 777e8960..6c097b2a 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
@@ -125,9 +125,7 @@ public class HashDataViewer extends JDialog
InputStreamReader isr = new InputStreamReader(hashDataInput.getHashDataInput(), cs);
Reader content = new BufferedReader(isr);
- JPanel hashDataPanel = createViewerPanel(
- messages.getString(BKUGUIFacade.MESSAGE_HASHDATA),
- content,
+ JPanel hashDataPanel = createViewerPanel(content,
hashDataInput.getMimeType(),
helpListener);
JPanel buttonPanel = createButtonPanel(saveListener, saveCommand);
@@ -169,29 +167,28 @@ public class HashDataViewer extends JDialog
* @param helpListener may be null
* @return
*/
- private JPanel createViewerPanel(String viewerLabelText,
- Reader content,
+ private JPanel createViewerPanel(Reader content,
String mimeType,
final ActionListener helpListener) {
- log.debug("viewer dialog: " + mimeType);
if (mimeType == null) {
mimeType = "text/plain";
- } else if ("application/xhtml+xml".equals(mimeType)) {
- mimeType = "text/html";
}
+ log.debug("viewer dialog: " + mimeType);
JEditorPane viewer = new JEditorPane();
+ viewer.setEditable(false);
+ viewer.setContentType(mimeType);
if ("text/plain".equals(mimeType)) {
viewer.setEditorKit(new StyledEditorKit());
viewer.setFont(new Font(PLAINTEXT_FONT, viewer.getFont().getStyle(), viewer.getFont().getSize()));
// } else if ("text/html".equals(mimeType)) {
// viewer.setEditorKit(new RestrictedHTMLEditorKit());
+ } else if ("application/xhtml+xml".equals(mimeType)) {
+ viewer.setContentType("text/html");
}
- viewer.setEditable(false);
- viewer.setContentType(mimeType);
-
+
EditorKit editorKit = viewer.getEditorKit();
Document document = editorKit.createDefaultDocument();
// document.putProperty("IgnoreCharsetDirective", new Boolean(true));
@@ -210,15 +207,23 @@ public class HashDataViewer extends JDialog
scrollPane.setAlignmentX(LEFT_ALIGNMENT);
viewer.setCaretPosition(0);
- JLabel viewerLabel = new JLabel();
- viewerLabel.setText(viewerLabelText);
- viewerLabel.setFont(viewerLabel.getFont().deriveFont(viewerLabel.getFont().getStyle() | java.awt.Font.BOLD));
- viewerLabel.setLabelFor(viewer);
-
JPanel viewerPanel = new JPanel();
GroupLayout viewerPanelLayout = new GroupLayout(viewerPanel);
viewerPanel.setLayout(viewerPanelLayout);
+ GroupLayout.SequentialGroup infoHorizontal = viewerPanelLayout.createSequentialGroup();
+ GroupLayout.ParallelGroup infoVertical = viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
+
+ if ("application/xhtml+xml".equals(mimeType)) {
+ JLabel viewerLabel = new JLabel();
+ viewerLabel.setText(messages.getString(BKUGUIFacade.WARNING_XHTML));
+ viewerLabel.setFont(viewerLabel.getFont().deriveFont(viewerLabel.getFont().getStyle() | java.awt.Font.BOLD));
+ viewerLabel.setLabelFor(viewer);
+
+ infoHorizontal.addComponent(viewerLabel);
+ infoVertical.addComponent(viewerLabel);
+ }
+
if (helpListener != null) {
JLabel helpLabel = new JLabel();
helpLabel.setIcon(new ImageIcon(getClass().getResource(BKUGUIFacade.HELP_IMG)));
@@ -232,27 +237,24 @@ public class HashDataViewer extends JDialog
}
});
helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
- viewerPanelLayout.setHorizontalGroup(
- viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(viewerPanelLayout.createSequentialGroup().addComponent(viewerLabel).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel)).addComponent(scrollPane)); //, 0, 0, Short.MAX_VALUE));
- viewerPanelLayout.setVerticalGroup(
- viewerPanelLayout.createSequentialGroup()
- .addGroup(viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(viewerLabel)
- .addComponent(helpLabel))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(scrollPane));
- } else {
- viewerPanelLayout.setHorizontalGroup(
- viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(viewerLabel)
- .addComponent(scrollPane));
- viewerPanelLayout.setVerticalGroup(
- viewerPanelLayout.createSequentialGroup()
- .addComponent(viewerLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(scrollPane));
+ infoHorizontal
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel);
+ infoVertical
+ .addComponent(helpLabel);
}
+
+ viewerPanelLayout.setHorizontalGroup(
+ viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(infoHorizontal)
+ .addComponent(scrollPane));
+ viewerPanelLayout.setVerticalGroup(
+ viewerPanelLayout.createSequentialGroup()
+ .addGroup(infoVertical)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(scrollPane));
+
return viewerPanel;
}
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index 88119fe2..a7363421 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -32,13 +32,14 @@ message.wait=Bitte warten...
message.insertcard=Bitte die B\u00FCrgerkarte in den Kartenleser stecken
message.enterpin={0} eingeben
message.hashdatalink=Signaturdaten anzeigen
-message.hashdata=Hinweis: Dies ist eine Voransicht des zu signierenden Inhalts. F\u00FCr eine standardkonforme Darstellung siehe Hilfe (i).
+#message.hashdata=Hinweis: Dies ist eine Voransicht des zu signierenden Inhalts. F\u00FCr eine standardkonforme Darstellung siehe Hilfe (i).
#message.hashdata=Dies ist eine Voransicht des zu signierenden Inhaltes. F\u00FCr Details siehe Hilfe (i).
#verwenden sie bitte die von ihrem System zur Verf\u00FCgung gestellte {0} Anwendung.
message.hashdatalist={0} Signaturdaten:
message.retries=Noch {0} Versuch(e)
message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?
message.help=Hilfe zu {0}
+warning.xhtml=Hinweis: Dies ist eine Voransicht des zu signierenden Inhalts. F\u00FCr eine standardkonforme Darstellung siehe Hilfe (i).
label.pin={0}:
label.pinsize=({0} stellig)
button.ok=OK
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
index 63c8bf77..7aae8eae 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
@@ -32,11 +32,12 @@ message.wait=Please wait...
message.insertcard=Please insert your citizencard into the reader
message.enterpin=Enter {0}
message.hashdatalink=Display signature data
-message.hashdata=Remark: This is a preview of the data to-be signed. For standards compliant display see help.
+#message.hashdata=Remark: This is a preview of the data to-be signed. For standards compliant display see help.
message.hashdatalist={0} signature data objects:
message.retries={0} tries left
message.overwrite=Overwrite {0}?
message.help=Help topic {0}
+warning.xhtml=Remark: This is a preview of the data to-be signed. For standards compliant display see help.
label.pin={0}:
label.pinsize=({0} digits)
button.ok=OK
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
index 0d2712dd..bc4bdb97 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
@@ -32,15 +32,15 @@ import org.junit.Test;
*
* @author clemens
*/
-//@Ignore
+@Ignore
public class BKUGUITest {
@Test
public void testBKUGUI() {
JFrame testFrame = new JFrame("BKUGUITest");
Container contentPane = testFrame.getContentPane();
- contentPane.setPreferredSize(new Dimension(380, 150));
- BKUGUIFacade gui = BKUGUIFactory.createGUI(contentPane, null, BKUGUIFacade.Style.advanced, null, null);
+ contentPane.setPreferredSize(new Dimension(190, 130));
+ BKUGUIFacade gui = BKUGUIFactory.createGUI(contentPane, null, BKUGUIFacade.Style.simple, null, null);
BKUGUIWorker worker = new BKUGUIWorker();
worker.init(gui);
testFrame.pack();
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index fec097f5..4d97f9fb 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -147,10 +147,13 @@ public class BKUGUIWorker implements Runnable {
//
// Thread.sleep(2000);
//
- gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
+// 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);
--
cgit v1.2.3
From 9ef5d25ffec1c26ccf76ad46131e33a861335da1 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Fri, 23 Jan 2009 13:45:39 +0000
Subject: tiny applet
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@286 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../at/gv/egiz/bku/online/applet/BKUApplet.java | 5 +-
BKUApplet/src/test/resources/appletTest.html | 12 +-
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 4 +-
.../main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 140 ++++++++++++++++-----
.../at/gv/egiz/bku/gui/HashDataTableModel.java | 21 +++-
.../java/at/gv/egiz/bku/gui/HyperlinkRenderer.java | 14 ++-
.../at/gv/egiz/bku/gui/Messages.properties | 4 +-
.../at/gv/egiz/bku/gui/Messages_en.properties | 5 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 4 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 6 +-
10 files changed, 158 insertions(+), 57 deletions(-)
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
index 41dae3ba..5e60ed3e 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BKUApplet.java
@@ -91,8 +91,11 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
log.debug("setting locale to " + getLocale());
BKUGUIFacade.Style guiStyle;
- if ("advanced".equals(getAppletParameter(GUI_STYLE))) {
+ String guiStyleParam = getAppletParameter(GUI_STYLE);
+ if ("advanced".equals(guiStyleParam)) {
guiStyle = BKUGUIFacade.Style.advanced;
+ } else if ("tiny".equals(guiStyleParam)) {
+ guiStyle = BKUGUIFacade.Style.tiny;
} else {
guiStyle = BKUGUIFacade.Style.simple;
}
diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html
index 2bf9ba0c..c8bd99d3 100644
--- a/BKUApplet/src/test/resources/appletTest.html
+++ b/BKUApplet/src/test/resources/appletTest.html
@@ -19,15 +19,13 @@
-
-
+ width=152 height=145>
+
+
-
-
+
+
-
-
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index 5ee0058f..51906616 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -63,9 +63,11 @@ public interface BKUGUIFacade {
public static final String MESSAGE_INSERTCARD = "message.insertcard";
public static final String MESSAGE_ENTERPIN = "message.enterpin";
public static final String MESSAGE_HASHDATALINK = "message.hashdatalink";
+ public static final String MESSAGE_HASHDATALINK_TINY = "message.hashdatalink.tiny";
// public static final String MESSAGE_HASHDATA = "message.hashdata";
public static final String MESSAGE_HASHDATALIST = "message.hashdatalist";
public static final String MESSAGE_RETRIES = "message.retries";
+ public static final String MESSAGE_LAST_RETRY = "message.retries.last";
public static final String MESSAGE_OVERWRITE = "message.overwrite";
public static final String MESSAGE_HELP = "message.help";
public static final String WARNING_XHTML = "warning.xhtml";
@@ -90,7 +92,7 @@ public interface BKUGUIFacade {
public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix";
public static final String ALT_HELP = "alt.help";
- public enum Style { simple, advanced };
+ public enum Style { tiny, simple, advanced };
// public void init(Container contentPane, Locale locale, Style guiStyle, URL background, ActionListener helpListener);
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 d61c9a03..1e63c8d7 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
@@ -53,6 +53,7 @@ import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JScrollPane;
import javax.swing.JTable;
+import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
@@ -69,6 +70,10 @@ public class BKUGUIImpl implements BKUGUIFacade {
private static final Log log = LogFactory.getLog(BKUGUIImpl.class);
+ protected enum PinLabelPosition {
+ LEFT, ABOVE
+ }
+
protected HelpMouseListener helpListener;
protected Container contentPane;
@@ -92,6 +97,9 @@ public class BKUGUIImpl implements BKUGUIFacade {
protected boolean renderHeaderPanel = false;
protected boolean renderIconPanel = false;
protected boolean renderCancelButton = false;
+ protected boolean shortText = false;
+ protected PinLabelPosition pinLabelPos = PinLabelPosition.LEFT;
+ protected boolean renderRefId = false;
/**
* set contentPane
@@ -125,6 +133,10 @@ public class BKUGUIImpl implements BKUGUIFacade {
renderHeaderPanel = true;
renderIconPanel = false;
renderCancelButton = true;
+ renderRefId = true;
+ } else if (guiStyle == Style.tiny) {
+ shortText = true;
+ pinLabelPos = PinLabelPosition.ABOVE;
}
registerHelpListener(helpListener);
@@ -537,11 +549,21 @@ public class BKUGUIImpl implements BKUGUIFacade {
if (numRetries < 0) {
infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
String infoPattern = messages.getString(MESSAGE_ENTERPIN);
- infoLabel.setText(MessageFormat.format(infoPattern, new Object[] {pinSpec.getLocalizedName()}));
+ if (shortText) {
+ infoLabel.setText(MessageFormat.format(infoPattern, new Object[] {"PIN"}));
+ } else {
+ infoLabel.setText(MessageFormat.format(infoPattern, new Object[] {pinSpec.getLocalizedName()}));
+ }
helpListener.setHelpTopic(HELP_CARDPIN);
} else {
+ String retryPattern;
+ if (numRetries < 2) {
+ retryPattern = messages.getString(MESSAGE_LAST_RETRY);
+ } else {
+ retryPattern = messages.getString(MESSAGE_RETRIES);
+ }
infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD));
- infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)}));
+ infoLabel.setText(MessageFormat.format(retryPattern, new Object[]{String.valueOf(numRetries)}));
infoLabel.setForeground(ERROR_COLOR);
helpListener.setHelpTopic(HELP_RETRY);
}
@@ -570,27 +592,47 @@ public class BKUGUIImpl implements BKUGUIFacade {
infoVertical
.addComponent(helpLabel);
}
-
- mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addGroup(infoHorizontal)
+
+ GroupLayout.Group pinHorizontal;
+ GroupLayout.Group pinVertical;
+
+ if (pinLabelPos == PinLabelPosition.ABOVE) {
+ pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(mainPanelLayout.createSequentialGroup()
- .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
- .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //))
- .addComponent(pinsizeLabel))));
- mainPanelLayout.setVerticalGroup(
- mainPanelLayout.createSequentialGroup()
- .addGroup(infoVertical)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE));
+ pinVertical = mainPanelLayout.createSequentialGroup()
+ .addComponent(cardPinLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(cardPinLabel)
- .addComponent(pinField))
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
+ } else {
+ pinHorizontal = mainPanelLayout.createSequentialGroup()
+ .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(pinsizeLabel));
-
-
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(pinsizeLabel));
+ pinVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(cardPinLabel)
+ .addComponent(pinField);
+ }
+
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(infoHorizontal)
+ .addGroup(pinHorizontal));
+
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createSequentialGroup()
+ .addGroup(infoVertical)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(pinVertical)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(pinsizeLabel));
+
+
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
@@ -707,7 +749,11 @@ public class BKUGUIImpl implements BKUGUIFacade {
JLabel infoLabel = new JLabel();
if (numRetries < 0) {
infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- infoLabel.setText(messages.getString(MESSAGE_HASHDATALINK));
+ if (shortText) {
+ infoLabel.setText(messages.getString(MESSAGE_HASHDATALINK_TINY));
+ } else {
+ infoLabel.setText(messages.getString(MESSAGE_HASHDATALINK));
+ }
infoLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
infoLabel.setForeground(HYPERLINK_COLOR);
infoLabel.addMouseListener(new MouseAdapter() {
@@ -720,8 +766,14 @@ public class BKUGUIImpl implements BKUGUIFacade {
});
helpListener.setHelpTopic(HELP_SIGNPIN);
} else {
+ String retryPattern;
+ if (numRetries < 2) {
+ retryPattern = messages.getString(MESSAGE_LAST_RETRY);
+ } else {
+ retryPattern = messages.getString(MESSAGE_RETRIES);
+ }
+ infoLabel.setText(MessageFormat.format(retryPattern, new Object[]{String.valueOf(numRetries)}));
infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD));
- infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)}));
infoLabel.setForeground(ERROR_COLOR);
helpListener.setHelpTopic(HELP_RETRY);
}
@@ -737,28 +789,48 @@ public class BKUGUIImpl implements BKUGUIFacade {
if (!renderHeaderPanel) {
infoHorizontal
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
- .addComponent(helpLabel); //, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
+ .addComponent(helpLabel);
infoVertical
.addComponent(helpLabel);
}
+ GroupLayout.Group pinHorizontal;
+ GroupLayout.Group pinVertical;
+
+ if (pinLabelPos == PinLabelPosition.ABOVE) {
+ pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addComponent(pinField, 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 = mainPanelLayout.createSequentialGroup()
+ .addComponent(signPinLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
+ } else {
+ pinHorizontal = mainPanelLayout.createSequentialGroup()
+ .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(pinsizeLabel));
+ pinVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(signPinLabel)
+ .addComponent(pinField);
+ }
+
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addGroup(infoHorizontal)
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
- .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(pinsizeLabel))));
+ .addGroup(pinHorizontal));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
.addGroup(infoVertical)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(signPinLabel)
- .addComponent(pinField))
+ .addGroup(pinVertical)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pinsizeLabel));
@@ -1084,9 +1156,9 @@ public class BKUGUIImpl implements BKUGUIFacade {
String refIdLabelPattern = messages.getString(MESSAGE_HASHDATALIST);
refIdLabel.setText(MessageFormat.format(refIdLabelPattern, new Object[]{signedReferences.size()}));
- HashDataTableModel tableModel = new HashDataTableModel(signedReferences);
+ HashDataTableModel tableModel = new HashDataTableModel(signedReferences, renderRefId);
final JTable hashDataTable = new JTable(tableModel);
- hashDataTable.setDefaultRenderer(HashDataInput.class, new HyperlinkRenderer());
+ hashDataTable.setDefaultRenderer(HashDataInput.class, new HyperlinkRenderer(renderRefId));
hashDataTable.setTableHeader(null);
// not possible to add mouse listener to TableCellRenderer
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
index b0f51a78..70842102 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataTableModel.java
@@ -31,14 +31,23 @@ class HashDataTableModel extends DefaultTableModel {
protected static final Log log = LogFactory.getLog(HashDataTableModel.class);
/** HashDataInput in first column, register hyperlinkrenderer only here */
- protected Class[] types = new Class[]{ HashDataInput.class, String.class };
+ protected Class[] types;
protected List hashDataInputs;
-
- public HashDataTableModel(List hashDataInputs) {
- super(0, 2);
+
+ public HashDataTableModel(List hashDataInputs, boolean twoColLayout) {
+ super(0, (twoColLayout) ? 2 : 1);
this.hashDataInputs = hashDataInputs;
- for (HashDataInput hdi : hashDataInputs) {
- addRow(new Object[]{ hdi, hdi.getMimeType()});
+
+ if (twoColLayout) {
+ types = new Class[] { HashDataInput.class, String.class };
+ for (HashDataInput hdi : hashDataInputs) {
+ addRow(new Object[] { hdi, hdi.getMimeType() });
+ }
+ } else {
+ types = new Class[] { HashDataInput.class };
+ for (HashDataInput hdi : hashDataInputs) {
+ addRow(new Object[] { hdi });
+ }
}
}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java
index f983706e..16024fcc 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HyperlinkRenderer.java
@@ -26,13 +26,25 @@ import javax.swing.table.DefaultTableCellRenderer;
*/
public class HyperlinkRenderer extends DefaultTableCellRenderer {
+ protected boolean renderReferenceId;
+
+ public HyperlinkRenderer(boolean renderReferenceId) {
+ this.renderReferenceId = renderReferenceId;
+ }
+
/**
* cannot change mouse cursor here, do in jTable
* @param value
*/
@Override
protected void setValue(Object value) {
- super.setText("" + ((HashDataInput) value).getReferenceId() + " ");
+ String hrefText;
+ if (renderReferenceId) {
+ hrefText = ((HashDataInput) value).getReferenceId();
+ } else {
+ hrefText = ((HashDataInput) value).getMimeType();
+ }
+ super.setText("" + hrefText + " ");
setForeground(BKUGUIFacade.HYPERLINK_COLOR);
}
}
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index d2b47a9d..4562fda5 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -32,11 +32,13 @@ message.wait=Bitte warten...
message.insertcard=Bitte die B\u00FCrgerkarte in den Kartenleser stecken
message.enterpin={0} eingeben
message.hashdatalink=Signaturdaten anzeigen
+message.hashdatalink.tiny=Signaturdaten
#message.hashdata=Hinweis: Dies ist eine Voransicht des zu signierenden Inhalts. F\u00FCr eine standardkonforme Darstellung siehe Hilfe (i).
#message.hashdata=Dies ist eine Voransicht des zu signierenden Inhaltes. F\u00FCr Details siehe Hilfe (i).
#verwenden sie bitte die von ihrem System zur Verf\u00FCgung gestellte {0} Anwendung.
message.hashdatalist={0} Signaturdaten:
-message.retries=Noch {0} Versuch(e)
+message.retries.last=Letzter Versuch!
+message.retries=Noch {0} Versuche
message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?
message.help=Hilfe zu {0}
warning.xhtml=Hinweis: Dies ist eine Voransicht des zu signierenden Inhalts. F\u00FCr eine standardkonforme Darstellung siehe Hilfe (i).
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
index 524a2a98..0faa3dba 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
@@ -32,8 +32,10 @@ message.wait=Please wait...
message.insertcard=Please insert your citizen card into the reader
message.enterpin=Enter {0}
message.hashdatalink=Display signature data
+message.hashdatalink.tiny=signature data
#message.hashdata=Remark: This is a preview of the data to-be signed. For standards compliant display see help.
message.hashdatalist={0} signature data objects:
+message.retries.last=Last try!
message.retries={0} tries left
message.overwrite=Overwrite {0}?
message.help=Help topic {0}
@@ -60,7 +62,8 @@ error.no.hashdata=No signature data available: {0}
error.display.hashdata=Could not display signature data: {0}
error.write.hashdata=Could not save signature data: {0}
error.invalid.hash=Invalid signature data: {0}
-error.ws.unreachable=Web-service unreachable: {0}
+error.ws.unreachable=Server unreachable
+#error.ws.unreachable=Web-service unreachable: {0}
error.pcsc=No PC/SC interface for smartcard access provided
error.cardterminal=Could not find smartcard reader
error.unknown=An error occured: {0}
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
index bc4bdb97..d413f812 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
@@ -39,8 +39,8 @@ public class BKUGUITest {
public void testBKUGUI() {
JFrame testFrame = new JFrame("BKUGUITest");
Container contentPane = testFrame.getContentPane();
- contentPane.setPreferredSize(new Dimension(190, 130));
- BKUGUIFacade gui = BKUGUIFactory.createGUI(contentPane, null, BKUGUIFacade.Style.simple, null, null);
+ contentPane.setPreferredSize(new Dimension(170, 150));
+ BKUGUIFacade gui = BKUGUIFactory.createGUI(contentPane, null, BKUGUIFacade.Style.tiny, null, null);
BKUGUIWorker worker = new BKUGUIWorker();
worker.init(gui);
testFrame.pack();
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index 4d97f9fb..73aaab46 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -142,17 +142,17 @@ public class BKUGUIWorker implements Runnable {
// 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");
+ gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
//
// Thread.sleep(4000);
//
- gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, null, null);
+// gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, null, null);
// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
//
--
cgit v1.2.3
From ff9a71fe2a2beb94ad7aa52ba2c77a24dd39509e Mon Sep 17 00:00:00 2001
From: clemenso
Date: Wed, 11 Feb 2009 20:04:58 +0000
Subject: removed BKUGUIFactory
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@297 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 1 +
.../java/at/gv/egiz/bku/gui/BKUGUIFactory.java | 34 ----------------------
.../main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 4 +--
.../at/gv/egiz/bku/gui/Messages.properties | 3 +-
.../at/gv/egiz/bku/gui/Messages_en.properties | 3 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUITest.java | 2 +-
6 files changed, 7 insertions(+), 40 deletions(-)
delete mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index 51906616..6fd29ba9 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -25,6 +25,7 @@ import java.util.Locale;
public interface BKUGUIFacade {
+ public static final String ERR_UNKNOWN_WITH_PARAM = "error.unknown.param";
public static final String ERR_UNKNOWN = "error.unknown";
public static final String ERR_SERVICE_UNREACHABLE = "error.ws.unreachable";
public static final String ERR_NO_PCSC = "error.pcsc";
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java
deleted file mode 100644
index 998aaa86..00000000
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFactory.java
+++ /dev/null
@@ -1,34 +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.event.ActionListener;
-import java.net.URL;
-import java.util.Locale;
-
-public class BKUGUIFactory {
-
- public static BKUGUIFacade createGUI(Container contentPane,
- Locale locale,
- BKUGUIFacade.Style style,
- URL background,
- ActionListener helpListener) {
- return new BKUGUIImpl(contentPane, locale, style, background, helpListener);
- }
-}
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 1e63c8d7..f564c07a 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
@@ -19,14 +19,12 @@ 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.Container;
import java.awt.Cursor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import java.awt.event.MouseListener;
import java.awt.event.MouseMotionAdapter;
import java.io.BufferedOutputStream;
import java.io.File;
@@ -68,7 +66,7 @@ import org.apache.commons.logging.LogFactory;
*/
public class BKUGUIImpl implements BKUGUIFacade {
- private static final Log log = LogFactory.getLog(BKUGUIImpl.class);
+ protected static final Log log = LogFactory.getLog(BKUGUIImpl.class);
protected enum PinLabelPosition {
LEFT, ABOVE
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index 4562fda5..8436a730 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -68,7 +68,8 @@ error.ws.unreachable=Der Server ist nicht erreichbar
#error.ws.unreachable=Das Web-Service ist nicht erreichbar: {0}
error.pcsc=Es konnte keine PC/SC Schnittstelle gefunden werden
error.cardterminal=Es konnte kein Smartcard-Leser gefunden werden
-error.unknown=Leider trat ein Fehler auf: {0}
+error.unknown.param=Ein Fehler trat auf: {0}
+error.unknown=Ein Fehler trat auf
error.test=Fehler1 {0} - Fehler2 {1}
error.card.locked=B\u00FCrgerkarte ist gesperrt
error.card.notactivated=B\u00FCrgerkartenfunktion ist nicht aktiviert
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
index 0faa3dba..4fbccd5b 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
@@ -66,7 +66,8 @@ error.ws.unreachable=Server unreachable
#error.ws.unreachable=Web-service unreachable: {0}
error.pcsc=No PC/SC interface for smartcard access provided
error.cardterminal=Could not find smartcard reader
-error.unknown=An error occured: {0}
+error.unknown.param=An error occured: {0}
+error.unknown=An error occured
error.test=Error1 {0} - Error2 {1}
error.card.locked=Citizen card is locked
error.card.notactivated=Citizen card not activated
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
index d413f812..c8cff617 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
@@ -40,7 +40,7 @@ public class BKUGUITest {
JFrame testFrame = new JFrame("BKUGUITest");
Container contentPane = testFrame.getContentPane();
contentPane.setPreferredSize(new Dimension(170, 150));
- BKUGUIFacade gui = BKUGUIFactory.createGUI(contentPane, null, BKUGUIFacade.Style.tiny, null, null);
+ BKUGUIFacade gui = new BKUGUIImpl(contentPane, null, BKUGUIFacade.Style.tiny, null, null);
BKUGUIWorker worker = new BKUGUIWorker();
worker.init(gui);
testFrame.pack();
--
cgit v1.2.3
From 6576428966f1e3d688269a407b072fb01f9f7647 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Thu, 26 Feb 2009 19:39:00 +0000
Subject: 1.1 candidate (activation)
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@309 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../gv/egiz/bku/online/applet/AppletBKUWorker.java | 9 +-
.../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 519 ++++-
.../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 47 +-
.../java/at/gv/egiz/bku/gui/PINSpecRenderer.java | 39 +
.../java/at/gv/egiz/bku/gui/PINStatusProvider.java | 32 -
.../java/at/gv/egiz/bku/gui/PINStatusRenderer.java | 63 +
.../at/gv/egiz/bku/gui/PINStatusTableModel.java | 60 +
.../bku/online/applet/PINManagementApplet.java | 3 +-
.../bku/online/applet/PINManagementBKUWorker.java | 82 +-
.../smccstal/ext/PINManagementRequestHandler.java | 331 ++++
.../bku/smccstal/ext/PINMgmtRequestHandler.java | 93 -
.../gv/egiz/bku/gui/ActivationMessages.properties | 28 +-
.../egiz/bku/gui/ActivationMessages_en.properties | 30 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 4 +-
BKUAppletExt/src/test/resources/appletTest.html | 2 +-
.../main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 8 +-
.../main/java/at/gv/egiz/bku/gui/PinDocument.java | 28 +-
.../at/gv/egiz/bku/gui/Messages.properties | 4 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 2 +-
.../at/gv/egiz/stal/ext/ActivatePINRequest.java | 28 -
.../java/at/gv/egiz/stal/ext/ChangePINRequest.java | 28 -
.../at/gv/egiz/stal/ext/PINManagementRequest.java | 31 +
.../at/gv/egiz/stal/ext/PINManagementResponse.java | 28 +
.../at/gv/egiz/stal/ext/UnblockPINRequest.java | 28 -
.../egiz/bku/slcommands/impl/xsect/DataObject.java | 2078 ++++++++++----------
.../egiz/bku/slcommands/impl/xsect/Signature.java | 5 +-
.../bku/slcommands/impl/xsect/SignatureTest.java | 1505 +++++++-------
.../egiz/bku/slcommands/impl/TransformsInfo_2.xml | 397 ++++
smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java | 25 +-
.../at/gv/egiz/smcc/AbstractSignatureCard.java | 10 +
smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java | 30 +-
.../src/main/java/at/gv/egiz/smcc/STARCOSCard.java | 25 +-
smcc/src/main/java/at/gv/egiz/smcc/SWCard.java | 14 +-
.../main/java/at/gv/egiz/smcc/SignatureCard.java | 5 +-
.../at/gv/egiz/bku/smccstal/AbstractBKUWorker.java | 3 +
.../java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java | 9 +-
.../java/at/gv/egiz/marshal/NamespacePrefix.java | 34 +
.../gv/egiz/marshal/NamespacePrefixMapperImpl.java | 16 +-
.../at/gv/egiz/slbinding/RedirectEventFilter.java | 389 ++--
.../gv/egiz/slbinding/impl/TransformsInfoType.java | 1 +
.../at/gv/egiz/slbinding/impl/XMLContentType.java | 2 +-
.../org/w3/_2000/_09/xmldsig_/ObjectFactory.java | 1 +
.../org/w3/_2000/_09/xmldsig_/TransformsType.java | 2 +-
.../java/at/gv/egiz/slbinding/RedirectTest.java | 29 +-
.../CreateXMLSignatureRequest02.xml_redirect.txt | 5 +-
45 files changed, 3813 insertions(+), 2299 deletions(-)
create 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/PINStatusProvider.java
create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java
create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java
create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java
delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINMgmtRequestHandler.java
delete mode 100644 STALExt/src/main/java/at/gv/egiz/stal/ext/ActivatePINRequest.java
delete mode 100644 STALExt/src/main/java/at/gv/egiz/stal/ext/ChangePINRequest.java
create mode 100644 STALExt/src/main/java/at/gv/egiz/stal/ext/PINManagementRequest.java
create mode 100644 STALExt/src/main/java/at/gv/egiz/stal/ext/PINManagementResponse.java
delete mode 100644 STALExt/src/main/java/at/gv/egiz/stal/ext/UnblockPINRequest.java
create mode 100644 bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/impl/TransformsInfo_2.xml
create mode 100644 utils/src/main/java/at/gv/egiz/marshal/NamespacePrefix.java
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
index 5a57ef18..8c1bd2bd 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
@@ -195,11 +195,16 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable {
}
}
+ /**
+ *
+ * @param err_code
+ * @param ex if not null, the message will be appended as parameter to the error message
+ */
protected void showErrorDialog(String err_code, Exception ex) {
actionCommandList.clear();
actionCommandList.add("ok");
- gui.showErrorDialog(err_code,
- new Object[]{ex.getMessage()}, this, "ok");
+ Object[] params = (ex != null) ? new Object[] { ex.getMessage() } : null;
+ gui.showErrorDialog(err_code, params, this, "ok");
try {
waitForAction();
} catch (InterruptedException e) {
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
index 8acf051e..8eef8aea 100644
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java
@@ -17,15 +17,28 @@
package at.gv.egiz.bku.gui;
+import at.gv.egiz.smcc.PINSpec;
import java.awt.Container;
+import java.awt.Cursor;
+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;
/**
* TODO pull out ResourceBundle to common superclass for activationGUI and pinMgmtGUI
@@ -33,9 +46,10 @@ import javax.swing.SwingUtilities;
*/
public class PINManagementGUI extends ActivationGUI implements PINManagementGUIFacade {
- public static final String BUTTON_ACTIVATE = "button.activate";
- public static final String BUTTON_UNBLOCK = "button.unblock";
- public static final String BUTTON_CHANGE = "button.change";
+ /** 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,
@@ -46,12 +60,31 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF
}
@Override
- public void showPINManagementDialog(final PINStatusProvider pinStatusProvider,
- final ActionListener activateListener, final String activateCmd,
- final ActionListener changeListener, final String changeCmd,
- final ActionListener unblockListener, final String unblockCmd,
- final ActionListener cancelListener, final String cancelCmd) {
-// try {
+ public char[] getOldPin() {
+ if (oldPinField != null) {
+ char[] pin = oldPinField.getPassword();
+ oldPinField = null;
+ return pin;
+ }
+ return null;
+ }
+
+ @Override
+ public PINSpec getSelectedPIN() {
+ return pinSpec;
+ }
+
+ @Override
+ public void showPINManagementDialog(final Map pins,
+ final ActionListener activateListener,
+ final String activateCmd,
+ final String changeCmd,
+ final String unblockCmd,
+ final ActionListener cancelListener,
+ final String cancelCmd) {
+
+ log.debug("scheduling PIN managment dialog");
+
SwingUtilities.invokeLater(new Runnable() {
@Override
@@ -68,13 +101,76 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF
if (renderHeaderPanel) {
titleLabel.setText(cardmgmtMessages.getString(TITLE_PINMGMT));
- mgmtLabel.setText(cardmgmtMessages.getString(MESSAGE_PINMGMT));
+ String infoPattern = cardmgmtMessages.getString(MESSAGE_PINMGMT);
+ mgmtLabel.setText(MessageFormat.format(infoPattern, pins.size()));
} else {
mgmtLabel.setText(cardmgmtMessages.getString(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.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(cardmgmtMessages.getString(BUTTON_ACTIVATE));
+ activateButton.setEnabled(true);
+ activateButton.setActionCommand(activateCmd);
+ } else if (status == STATUS.BLOCKED) {
+ activateButton.setText(cardmgmtMessages.getString(BUTTON_UNBLOCK));
+ activateButton.setEnabled(true);
+ activateButton.setActionCommand(unblockCmd);
+ } else if (status == STATUS.ACTIV) {
+ activateButton.setText(cardmgmtMessages.getString(BUTTON_CHANGE));
+ activateButton.setEnabled(true);
+ activateButton.setActionCommand(changeCmd);
+ } else {
+ activateButton.setText(cardmgmtMessages.getString(BUTTON_ACTIVATE));
+ activateButton.setEnabled(false);
+ }
+ }
+ }
+ });
+ }
+ });
+
+ //select first entry
+ pinStatusTable.getSelectionModel().setSelectionInterval(0, 0);
+
+ JScrollPane pinStatusScrollPane = new JScrollPane(pinStatusTable);
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
@@ -91,30 +187,16 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF
.addComponent(helpLabel);
}
- mainPanelLayout.setHorizontalGroup(messageHorizontal);
- mainPanelLayout.setVerticalGroup(messageVertical);
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(messageHorizontal)
+ .addComponent(pinStatusScrollPane, 0, 0, Short.MAX_VALUE));
-
- JButton activateButton = new JButton();
- activateButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD));
- activateButton.setText(cardmgmtMessages.getString(BUTTON_ACTIVATE));
- activateButton.setEnabled(true);//false);
- activateButton.setActionCommand(activateCmd);
- activateButton.addActionListener(activateListener);
-
- JButton changeButton = new JButton();
- changeButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD));
- changeButton.setText(cardmgmtMessages.getString(BUTTON_CHANGE));
- changeButton.setEnabled(false);
- changeButton.setActionCommand(changeCmd);
- changeButton.addActionListener(changeListener);
-
- JButton unblockButton = new JButton();
- unblockButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD));
- unblockButton.setText(cardmgmtMessages.getString(BUTTON_UNBLOCK));
- unblockButton.setEnabled(false);
- unblockButton.setActionCommand(unblockCmd);
- unblockButton.addActionListener(unblockListener);
+ 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));
@@ -129,30 +211,377 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(activateButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(changeButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(unblockButton, 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(changeButton)
- .addComponent(unblockButton)
.addComponent(cancelButton);
buttonPanelLayout.setHorizontalGroup(buttonHorizontal);
buttonPanelLayout.setVerticalGroup(buttonVertical);
contentPanel.validate();
-
}
});
+ }
+
+ @Override
+ public void showActivatePINDialog(final PINSpec pin,
+ final ActionListener okListener, final String okCommand,
+ final ActionListener cancelListener, final String cancelCommand) {
+ log.debug("scheduling activate pin dialog");
+ showPINDialog(false, pin, okListener, okCommand, cancelListener, cancelCommand);
+ }
+
+
+ private void showPINDialog(final boolean changePin, final PINSpec pinSpec,
+ final ActionListener okListener, final String okCommand,
+ final ActionListener cancelListener, final String cancelCommand) {
+
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+
+ String HELP_TOPIC, TITLE, MESSAGE_MGMT;
+ if (changePin) {
+ log.debug("show change pin dialog");
+ HELP_TOPIC = HELP_PINMGMT;
+ TITLE = TITLE_CHANGE_PIN;
+ MESSAGE_MGMT = MESSAGE_CHANGE_PIN;
+ } else {
+ log.debug("show activate pin dialog");
+ HELP_TOPIC = HELP_PINMGMT;
+ TITLE = TITLE_ACTIVATE_PIN;
+ MESSAGE_MGMT = MESSAGE_ACTIVATE_PIN;
+ oldPinField = null;
+ }
+
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
+
+ helpListener.setHelpTopic(HELP_TOPIC);
+
+ JLabel mgmtLabel = new JLabel();
+ mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+
+ if (renderHeaderPanel) {
+ titleLabel.setText(cardmgmtMessages.getString(TITLE));
+ String mgmtPattern = cardmgmtMessages.getString(MESSAGE_MGMT);
+ if (shortText) {
+ mgmtLabel.setText(MessageFormat.format(mgmtPattern, "PIN"));
+ } else {
+ mgmtLabel.setText(MessageFormat.format(mgmtPattern, pinSpec.getLocalizedName()));
+ }
+ } else {
+ mgmtLabel.setText(cardmgmtMessages.getString(TITLE));
+ }
+
+ JButton okButton = new JButton();
+ okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD));
+ okButton.setText(messages.getString(BUTTON_OK));
+ okButton.setEnabled(false);
+ okButton.setActionCommand(okCommand);
+ okButton.addActionListener(okListener);
+
+ JLabel pinLabel = new JLabel();
+ pinLabel.setFont(pinLabel.getFont().deriveFont(pinLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ String pinLabelPattern = (changePin) ? cardmgmtMessages.getString(LABEL_NEW_PIN) : messages.getString(LABEL_PIN);
+ pinLabel.setText(MessageFormat.format(pinLabelPattern, new Object[]{pinSpec.getLocalizedName()}));
+
+ final JPasswordField repeatPinField = new JPasswordField();
+ pinField = new JPasswordField();
+ pinField.setText("");
+ pinField.setDocument(new PINDocument(pinSpec, null));
+ pinField.setActionCommand(okCommand);
+ pinField.addActionListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ if (pinField.getPassword().length >= pinSpec.getMinLength()) {
+ repeatPinField.requestFocusInWindow();
+ }
+ }
+ });
+ JLabel repeatPinLabel = new JLabel();
+ repeatPinLabel.setFont(pinLabel.getFont());
+ String repeatPinLabelPattern = cardmgmtMessages.getString(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);
+ }
+ }
+ });
+
+ JLabel oldPinLabel = null;
+ if (changePin) {
+ oldPinLabel = new JLabel();
+ oldPinLabel.setFont(oldPinLabel.getFont().deriveFont(oldPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ String oldPinLabelPattern = cardmgmtMessages.getString(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();
+ }
+ }
+ });
+ }
+
+ JLabel pinsizeLabel = new JLabel();
+ pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, pinsizeLabel.getFont().getSize()-2));
+ String pinsizePattern = messages.getString(LABEL_PINSIZE);
+ String pinSize = String.valueOf(pinSpec.getMinLength());
+ if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
+ pinSize += "-" + pinSpec.getMaxLength();
+ }
+ pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize}));
+
+ 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);
+ }
-// } catch (Exception ex) {
-// log.error(ex.getMessage(), ex);
-// showErrorDialog(ERR_UNKNOWN_WITH_PARAM, new Object[] {ex.getMessage()});
-// }
+ GroupLayout.ParallelGroup pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
+ GroupLayout.SequentialGroup 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 (changePin) {
+ 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);
+ } else {
+ 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)));
+
+ }
+ pinHorizontal
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE));
+ 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)
+ .addComponent(pinsizeLabel);
+ }
+
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(infoHorizontal)
+ .addGroup(pinHorizontal));
+
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createSequentialGroup()
+ .addGroup(infoVertical)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(pinVertical));
+
+ 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(messages.getString(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();
+ }
+ contentPanel.validate();
+
+ }
+ });
+ }
+
+ @Override
+ public void showChangePINDialog(final PINSpec pin,
+ final ActionListener okListener, final String okCommand,
+ final ActionListener cancelListener, final String cancelCommand) {
+
+ log.debug("scheduling change pin dialog");
+ showPINDialog(true, pin, okListener, okCommand, cancelListener, cancelCommand);
+ }
+
+ @Override
+ public void showUnblockPINDialog(final PINSpec pin,
+ final ActionListener okListener, final String okCommand,
+ final ActionListener cancelListener, final String cancelCommand) {
+
+ log.debug("scheduling unblock PIN dialog");
+
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+
+ log.debug("show unblock PIN dialog");
+
+ log.error("unblock pin not supported");
+
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
+
+ if (renderHeaderPanel) {
+ titleLabel.setText(messages.getString(TITLE_ERROR));
+ }
+
+ helpListener.setHelpTopic(HELP_PINMGMT);
+
+ String errorMsgPattern = cardmgmtMessages.getString(ERR_UNBLOCK);
+ String errorMsg = MessageFormat.format(errorMsgPattern, pin.getLocalizedName());
+
+ JLabel errorMsgLabel = new JLabel();
+ errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ errorMsgLabel.setText(errorMsg);
+
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanel.setLayout(mainPanelLayout);
+
+ GroupLayout.ParallelGroup mainHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
+ GroupLayout.SequentialGroup mainVertical = mainPanelLayout.createSequentialGroup();
+
+ if (!renderHeaderPanel) {
+ JLabel errorTitleLabel = new JLabel();
+ errorTitleLabel.setFont(errorTitleLabel.getFont().deriveFont(errorTitleLabel.getFont().getStyle() | java.awt.Font.BOLD));
+ errorTitleLabel.setText(messages.getString(TITLE_ERROR));
+ errorTitleLabel.setForeground(ERROR_COLOR);
+
+ mainHorizontal
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addComponent(errorTitleLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel));
+ mainVertical
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(errorTitleLabel)
+ .addComponent(helpLabel));
+ }
+
+ mainPanelLayout.setHorizontalGroup(mainHorizontal
+ .addComponent(errorMsgLabel));
+ mainPanelLayout.setVerticalGroup(mainVertical
+ .addComponent(errorMsgLabel));
+
+ JButton okButton = new JButton();
+ okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD));
+ okButton.setText(messages.getString(BUTTON_OK));
+ okButton.setActionCommand(cancelCommand);
+ okButton.addActionListener(cancelListener);
+
+ GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+ buttonPanel.setLayout(buttonPanelLayout);
+
+ buttonPanelLayout.setHorizontalGroup(
+ buttonPanelLayout.createSequentialGroup()
+ .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE));
+ buttonPanelLayout.setVerticalGroup(
+ buttonPanelLayout.createSequentialGroup()
+ .addComponent(okButton));
+
+ contentPanel.validate();
+ }
+ });
}
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
index 3d653fab..2a8f28d2 100644
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java
@@ -17,7 +17,9 @@
package at.gv.egiz.bku.gui;
+import at.gv.egiz.smcc.PINSpec;
import java.awt.event.ActionListener;
+import java.util.Map;
/**
*
@@ -27,8 +29,49 @@ public interface PINManagementGUIFacade extends BKUGUIFacade {
public static final String HELP_PINMGMT = "help.pin.mgmt";
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_UNBLOCK_PIN = "title.unblock.pin";
public static final String MESSAGE_PINMGMT = "message.pin.mgmt";
-
- public void showPINManagementDialog(PINStatusProvider pinStatusProvider, ActionListener activateListener, String activateCmd, ActionListener changeListener, String changeCmd, ActionListener unblockListener, String unblockCmd, ActionListener cancelListener, String cancelCmd);
+ public static final String MESSAGE_ACTIVATE_PIN = "message.activate.pin";
+ public static final String MESSAGE_CHANGE_PIN = "message.change.pin";
+ public static final String MESSAGE_UNBLOCK_PIN = "message.unblock.pin";
+ 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_ACTIVATE = "err.activate";
+ public static final String ERR_CHANGE = "err.change";
+ public static final String ERR_UNBLOCK = "err.unblock";
+
+ 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 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 void showPINManagementDialog(Map pins,
+ ActionListener activateListener, String activateCmd, String changeCmd, String unblockCmd,
+ ActionListener cancelListener, String cancelCmd);
+
+ 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 char[] getOldPin();
+
+ public PINSpec getSelectedPIN();
}
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
new file mode 100644
index 00000000..e3d73e1f
--- /dev/null
+++ b/BKUAppletExt/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/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusProvider.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusProvider.java
deleted file mode 100644
index 73fa0920..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusProvider.java
+++ /dev/null
@@ -1,32 +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.SignatureCardException;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public interface PINStatusProvider {
-
- public enum STATUS { ACTIV, NOT_ACTIV, BLOCKED };
-
- public STATUS getPINStatus(int pin) throws SignatureCardException;
-
-}
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
new file mode 100644
index 00000000..2f8852ff
--- /dev/null
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.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.
+ */
+
+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;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @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
new file mode 100644
index 00000000..feaa5072
--- /dev/null
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java
@@ -0,0 +1,60 @@
+/*
+ * 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;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @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/PINManagementApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java
index 72d06618..d948ac03 100644
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java
@@ -19,6 +19,7 @@ package at.gv.egiz.bku.online.applet;
import at.gv.egiz.bku.gui.AbstractHelpListener;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.gui.PINManagementGUI;
+import at.gv.egiz.bku.gui.PINManagementGUIFacade;
import java.awt.Container;
import java.net.URL;
import java.util.Locale;
@@ -45,6 +46,6 @@ public class PINManagementApplet extends BKUApplet {
@Override
protected AppletBKUWorker createBKUWorker(BKUApplet applet, BKUGUIFacade gui) {
- return new PINManagementBKUWorker(applet, gui);
+ return new PINManagementBKUWorker(applet, (PINManagementGUIFacade) gui);
}
}
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 e65d98ca..ffd83e42 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,35 +18,28 @@ 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.PINMgmtRequestHandler;
+import at.gv.egiz.bku.smccstal.ext.PINManagementRequestHandler;
+import at.gv.egiz.stal.ErrorResponse;
import at.gv.egiz.stal.STALResponse;
-import at.gv.egiz.stal.ext.ActivatePINRequest;
-import at.gv.egiz.stal.ext.ChangePINRequest;
-import at.gv.egiz.stal.ext.UnblockPINRequest;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Collection;
+import at.gv.egiz.stal.ext.PINManagementRequest;
+import at.gv.egiz.stal.ext.PINManagementResponse;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
- *
+ * This BKU Worker does not connect to STAL webservice
+ * (no Internet connection permitted while activating PINs).
+ *
* @author Clemens Orthacker
*/
public class PINManagementBKUWorker extends AppletBKUWorker {
- protected PINMgmtRequestHandler handler = new PINMgmtRequestHandler();
- protected PINManagementActionListener listener = new PINManagementActionListener();
-
- public PINManagementBKUWorker(BKUApplet applet, BKUGUIFacade gui) {
+ public PINManagementBKUWorker(BKUApplet applet, PINManagementGUIFacade gui) {
super(applet, gui);
handlerMap.clear();
-// PINMgmtRequestHandler handler = new PINMgmtRequestHandler();
-// addRequestHandler(ActivatePINRequest.class, handler);
-// addRequestHandler(ChangePINRequest.class, handler);
-// addRequestHandler(UnblockPINRequest.class, handler);
+ addRequestHandler(PINManagementRequest.class, new PINManagementRequestHandler());
}
@Override
@@ -54,22 +47,24 @@ public class PINManagementBKUWorker extends AppletBKUWorker {
gui.showWelcomeDialog();
try {
-
- if (waitForCard()) {
- gui.showErrorDialog("no card, canceled PIN mgmt dialog", null);
+ List responses = handleRequest(Collections.singletonList(new PINManagementRequest()));
+
+ if (responses.size() == 1) {
+ STALResponse response = responses.get(0);
+ if (response instanceof PINManagementResponse) {
+ log.debug("PIN management dialog finished");
+ } else if (response instanceof ErrorResponse) {
+ showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, null);
+ } else {
+ throw new RuntimeException("Invalid STAL response: " + response.getClass().getName());
+ }
+ } else {
+ throw new RuntimeException("invalid number of STAL responses: " + responses.size());
}
- actionCommandList.clear();
- actionCommandList.add("cancel");
-
- ((PINManagementGUIFacade) gui).showPINManagementDialog(handler,
- listener, "activate",
- listener, "change",
- listener, "unblock",
- this, "cancel");
-
- waitForAction();
-
+ } catch (RuntimeException ex) {
+ log.error("unexpected error: " + ex.getMessage(), ex);
+ showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, null);
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
showErrorDialog(BKUGUIFacade.ERR_UNKNOWN_WITH_PARAM, ex);
@@ -82,31 +77,4 @@ public class PINManagementBKUWorker extends AppletBKUWorker {
applet.sendRedirect(sessionId);
}
- protected class PINManagementActionListener implements ActionListener {
-
- @Override
- public void actionPerformed(ActionEvent e) {
- try {
- String cmd = e.getActionCommand();
- if ("activate".equals(cmd)) {
- //create STAL request, call handle(req)
- ActivatePINRequest stalReq = new ActivatePINRequest();
- STALResponse stalResp = handler.handleRequest(stalReq);
- gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN_WITH_PARAM, new Object[]{"debug"}, this, "back");
- } else if ("change".equals(cmd)) {
- } else if ("unblock".equals(cmd)) {
- } else if ("back".equals(cmd)) {
-
- ((PINManagementGUIFacade) gui).showPINManagementDialog(handler,
- this, "activate",
- this, "change",
- this, "unblock",
- PINManagementBKUWorker.this, "cancel");
-
- }
- } catch (InterruptedException ex) {
- log.fatal(ex);
- }
- }
}
-}
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
new file mode 100644
index 00000000..fcef3191
--- /dev/null
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java
@@ -0,0 +1,331 @@
+/*
+ * 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.bku.gui.PINManagementGUIFacade;
+import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS;
+import at.gv.egiz.bku.smccstal.AbstractRequestHandler;
+import at.gv.egiz.smcc.PINSpec;
+import at.gv.egiz.smcc.SignatureCardException;
+import at.gv.egiz.smcc.util.SMCCHelper;
+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;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+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;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class PINManagementRequestHandler extends AbstractRequestHandler {
+
+ public static final String ERR_NOPIN_SELECTED = "err.no.pin.selected";
+ protected static final Log log = LogFactory.getLog(PINManagementRequestHandler.class);
+
+// protected ResourceBundle messages;
+
+// public PINManagementRequestHandler(ResourceBundle messages) {
+// this.messages = messages;
+// }
+ @Override
+ public STALResponse handleRequest(STALRequest request) throws InterruptedException {
+ if (request instanceof PINManagementRequest) {
+
+ PINManagementGUIFacade gui = (PINManagementGUIFacade) this.gui;
+
+ showPINManagementDialog(gui);
+
+ while (true) {
+
+ waitForAction();
+
+ if ("cancel".equals(actionCommand)) {
+ return new PINManagementResponse();
+ } else if ("back".equals(actionCommand)) {
+ showPINManagementDialog(gui);
+ } else {
+ PINSpec selectedPIN = gui.getSelectedPIN();
+
+ if (selectedPIN == null) {
+ throw new RuntimeException("no PIN selected for activation/change");
+ }
+
+ if ("activate_enterpin".equals(actionCommand)) {
+ gui.showActivatePINDialog(selectedPIN, this, "activate", this, "back");
+ } else if ("change_enterpin".equals(actionCommand)) {
+ gui.showChangePINDialog(selectedPIN, this, "change", this, "back");
+ } else if ("unblock_enterpuk".equals(actionCommand)) {
+ gui.showUnblockPINDialog(selectedPIN, this, "unblock", this, "back");
+ } else if ("activate".equals(actionCommand)) {
+ try {
+ byte[] pin = encodePIN(gui.getPin());
+ activatePIN(selectedPIN.getKID(), selectedPIN.getContextAID(), pin);
+ showPINManagementDialog(gui);
+ } catch (SignatureCardException ex) {
+ log.error("failed to activate " + selectedPIN.getLocalizedName() + ": " + ex.getMessage());
+ gui.showErrorDialog(PINManagementGUIFacade.ERR_ACTIVATE,
+ new Object[] {selectedPIN.getLocalizedName()},
+ this, "cancel");
+ }
+ } else if ("change".equals(actionCommand)) {
+ try {
+ byte[] oldPin = encodePIN(gui.getOldPin()); //new byte[]{(byte) 0x25, (byte) 0x40, (byte) 0x01};
+ byte[] pin = encodePIN(gui.getPin()); //new byte[]{(byte) 0x25, (byte) 0x40};
+ changePIN(selectedPIN.getKID(), selectedPIN.getContextAID(), oldPin, pin);
+ showPINManagementDialog(gui);
+ } catch (SignatureCardException ex) {
+ log.error("failed to change " + selectedPIN.getLocalizedName() + ": " + ex.getMessage());
+ gui.showErrorDialog(PINManagementGUIFacade.ERR_CHANGE,
+ new Object[] {selectedPIN.getLocalizedName()},
+ this, "cancel");
+ }
+ } else if ("unblock".equals(actionCommand)) {
+ log.error("unblock PIN not implemented");
+ gui.showErrorDialog(PINManagementGUIFacade.ERR_UNBLOCK, null, this, "cancel");
+ } else {
+ throw new RuntimeException("unsupported action " + actionCommand);
+ }
+ }
+ }
+ } else {
+ log.error("Got unexpected STAL request: " + request);
+ return new ErrorResponse(1000);
+ }
+ }
+
+ @Override
+ public boolean requireCard() {
+ return true;
+ }
+
+ /**
+ * pin.length < 4bit
+ * @param kid
+ * @param contextAID
+ * @param pin
+ * @throws at.gv.egiz.smcc.SignatureCardException
+ */
+ private void activatePIN(byte kid, byte[] contextAID, byte[] pin) throws SignatureCardException {
+ try {
+ Card icc = card.getCard();
+ icc.beginExclusive();
+ CardChannel channel = icc.getBasicChannel();
+
+ if (contextAID != null) {
+ CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID);
+ ResponseAPDU responseAPDU = channel.transmit(selectAPDU);
+ if (responseAPDU.getSW() != 0x9000) {
+ String msg = "Failed to activate PIN " + SMCCHelper.toString(new byte[]{kid}) +
+ ": Failed to select AID " + SMCCHelper.toString(contextAID) +
+ ": " + SMCCHelper.toString(responseAPDU.getBytes());
+ log.error(msg);
+ throw new SignatureCardException(msg);
+ }
+ }
+
+ if (pin.length > 7) {
+ log.error("Invalid PIN");
+ throw new SignatureCardException("Invalid PIN");
+ }
+ byte length = (byte) (0x20 | pin.length * 2);
+
+ byte[] apdu = new byte[]{
+ (byte) 0x00, (byte) 0x24, (byte) 0x01, kid, (byte) 0x08,
+ (byte) length, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
+ for (int i = 0; i < pin.length; i++) {
+ apdu[i + 6] = pin[i];
+ }
+
+ CommandAPDU verifyAPDU = new CommandAPDU(apdu);
+ ResponseAPDU responseAPDU = channel.transmit(verifyAPDU);
+
+ if (responseAPDU.getSW() != 0x9000) {
+ String msg = "Failed to activate PIN " + SMCCHelper.toString(new byte[]{kid}) + ": " + SMCCHelper.toString(responseAPDU.getBytes());
+ log.error(msg);
+ throw new SignatureCardException(msg);
+ }
+
+
+ icc.endExclusive();
+
+
+ } catch (CardException ex) {
+ log.error("Failed to get PIN status: " + ex.getMessage());
+ throw new SignatureCardException("Failed to get PIN status", ex);
+ }
+ }
+
+ private void changePIN(byte kid, byte[] contextAID, byte[] oldPIN, byte[] newPIN) throws SignatureCardException {
+ try {
+ Card icc = card.getCard();
+ icc.beginExclusive();
+ CardChannel channel = icc.getBasicChannel();
+
+ if (contextAID != null) {
+ CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID);
+ ResponseAPDU responseAPDU = channel.transmit(selectAPDU);
+ if (responseAPDU.getSW() != 0x9000) {
+ String msg = "Failed to change PIN " + SMCCHelper.toString(new byte[]{kid}) +
+ ": Failed to select AID " + SMCCHelper.toString(contextAID) +
+ ": " + SMCCHelper.toString(responseAPDU.getBytes());
+ log.error(msg);
+ throw new SignatureCardException(msg);
+ }
+ }
+
+ if (oldPIN.length > 7 || newPIN.length > 7) {
+ log.error("Invalid PIN");
+ throw new SignatureCardException("Invalid PIN");
+ }
+ byte oldLength = (byte) (0x20 | oldPIN.length * 2);
+ byte newLength = (byte) (0x20 | newPIN.length * 2);
+
+ byte[] apdu = new byte[]{
+ (byte) 0x00, (byte) 0x24, (byte) 0x00, kid, (byte) 0x10,
+ oldLength, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+ newLength, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF};
+ for (int i = 0; i < oldPIN.length; i++) {
+ apdu[i + 6] = oldPIN[i];
+ }
+ for (int i = 0; i < newPIN.length; i++) {
+ apdu[i + 14] = newPIN[i];
+ }
+
+ CommandAPDU verifyAPDU = new CommandAPDU(apdu);
+ ResponseAPDU responseAPDU = channel.transmit(verifyAPDU);
+
+ if (responseAPDU.getSW() != 0x9000) {
+ String msg = "Failed to change PIN " + SMCCHelper.toString(new byte[]{kid}) + ": " + SMCCHelper.toString(responseAPDU.getBytes());
+ log.error(msg);
+ throw new SignatureCardException(msg);
+ }
+
+
+ icc.endExclusive();
+
+
+ } catch (CardException ex) {
+ log.error("Failed to get PIN status: " + ex.getMessage());
+ throw new SignatureCardException("Failed to get PIN status", ex);
+ }
+ }
+
+ public Map getPINStatuses() throws SignatureCardException {
+ try {
+ Card icc = card.getCard();
+ icc.beginExclusive();
+ CardChannel channel = icc.getBasicChannel();
+
+ HashMap pinStatuses = new HashMap();
+ List pins = card.getPINSpecs();
+
+ //select DF_SichereSignatur 00 A4 04 0C 08 D0 40 00 00 17 00 12 01
+// CommandAPDU selectAPDU = new CommandAPDU(new byte[]{(byte) 0x00, (byte) 0xa4, (byte) 0x04, (byte) 0x0c, (byte) 0x08,
+// (byte) 0xd0, (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x12, (byte) 0x01});
+// ResponseAPDU rAPDU = channel.transmit(selectAPDU);
+// log.debug("SELECT FILE DF_SichereSignatur: " + SMCCHelper.toString(rAPDU.getBytes()));
+
+ //select DF_SIG DF 70
+// CommandAPDU selectAPDU = new CommandAPDU(new byte[]{(byte) 0x00, (byte) 0xa4, (byte) 0x00, (byte) 0x0c, (byte) 0x02,
+// (byte) 0xdf, (byte) 0x70 });
+// ResponseAPDU rAPDU = channel.transmit(selectAPDU);
+// log.debug("SELECT FILE DF_SIG: " + SMCCHelper.toString(rAPDU.getBytes()));
+
+ //select DF_DEC DF 71
+// CommandAPDU selectAPDU = new CommandAPDU(new byte[]{(byte) 0x00, (byte) 0xa4, (byte) 0x04, (byte) 0x0c, (byte) 0x08,
+// (byte) 0xd0, (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x12, (byte) 0x01});
+// ResponseAPDU rAPDU = channel.transmit(selectAPDU);
+// log.debug("SELECT FILE DF_SichereSignatur: " + SMCCHelper.toString(rAPDU.getBytes()));
+
+ for (PINSpec pinSpec : pins) {
+ byte kid = pinSpec.getKID();
+ byte[] contextAID = pinSpec.getContextAID();
+
+ if (contextAID != null) {
+ CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID);
+ ResponseAPDU responseAPDU = channel.transmit(selectAPDU);
+ if (responseAPDU.getSW() != 0x9000) {
+ String msg = "Failed to activate PIN " + SMCCHelper.toString(new byte[]{kid}) +
+ ": Failed to select AID " + SMCCHelper.toString(contextAID) +
+ ": " + SMCCHelper.toString(responseAPDU.getBytes());
+ log.error(msg);
+ throw new SignatureCardException(msg);
+ }
+ }
+
+ CommandAPDU verifyAPDU = new CommandAPDU(new byte[]{(byte) 0x00, (byte) 0x20, (byte) 00, kid});
+ ResponseAPDU responseAPDU = channel.transmit(verifyAPDU);
+
+ STATUS status = STATUS.UNKNOWN;
+ if (responseAPDU.getSW() == 0x6984) {
+ status = STATUS.NOT_ACTIV;
+ } else if (responseAPDU.getSW() == 0x63c0) {
+ status = STATUS.BLOCKED;
+ } else if (responseAPDU.getSW1() == 0x63) {
+ status = STATUS.ACTIV;
+ }
+ if (log.isDebugEnabled()) {
+ log.debug("PIN " + pinSpec.getLocalizedName() + " status: " + SMCCHelper.toString(responseAPDU.getBytes()));
+ }
+
+ pinStatuses.put(pinSpec, status);
+ }
+ icc.endExclusive();
+
+ return pinStatuses;
+
+ } catch (CardException ex) {
+ log.error("Failed to get PIN status: " + ex.getMessage());
+ throw new SignatureCardException("Failed to get PIN status", ex);
+ }
+ }
+
+ private byte[] encodePIN(char[] pinChars) {
+ int length = (int) Math.ceil(pinChars.length/2);
+ byte[] pin = new byte[length];
+ for (int i = 0; i < length; i++) {
+ pin[i] = (byte) (16*Character.digit(pinChars[i*2], 16) + Character.digit(pinChars[i*2+1], 16));
+ }
+ log.trace("***** " + SMCCHelper.toString(pin) + " ******");
+ return pin;
+ }
+
+ private void showPINManagementDialog(PINManagementGUIFacade gui) {
+ try {
+ Map pins = getPINStatuses();
+ gui.showPINManagementDialog(pins,
+ this, "activate_enterpin", "change_enterpin", "unblock_enterpuk",
+ this, "cancel");
+ } catch (SignatureCardException ex) {
+ gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN_WITH_PARAM,
+ new Object[]{"FAILED TO GET PIN STATUSES: " + ex.getMessage()},
+ this, "cancel");
+ }
+ }
+}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINMgmtRequestHandler.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINMgmtRequestHandler.java
deleted file mode 100644
index b2d34ff2..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINMgmtRequestHandler.java
+++ /dev/null
@@ -1,93 +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.PINStatusProvider;
-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.ActivatePINRequest;
-import at.gv.egiz.stal.ext.ChangePINRequest;
-import at.gv.egiz.stal.ext.UnblockPINRequest;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-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;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class PINMgmtRequestHandler extends AbstractRequestHandler implements PINStatusProvider {
-
- protected static final Log log = LogFactory.getLog(PINMgmtRequestHandler.class);
-
- @Override
- public STALResponse handleRequest(STALRequest request) throws InterruptedException {
- if (request instanceof ActivatePINRequest) {
- log.error("not implemented yet");
- return new ErrorResponse(1000);
-
- } else if (request instanceof ChangePINRequest) {
- log.error("not implemented yet");
- return new ErrorResponse(1000);
-
- } else if (request instanceof UnblockPINRequest) {
- log.error("not implemented yet");
- return new ErrorResponse(1000);
-
- } else {
- log.error("Got unexpected STAL request: " + request);
- return new ErrorResponse(1000);
- }
- }
-
- @Override
- public boolean requireCard() {
- return true;
- }
-
- @Override
- public STATUS getPINStatus(int pin) throws SignatureCardException {
- try {
- Card icc = card.getCard();
- icc.beginExclusive();
- CardChannel channel = icc.getBasicChannel();
- CommandAPDU verifyAPDU = new CommandAPDU(new byte[] {(byte) 0x00} );
- ResponseAPDU responseAPDU = channel.transmit(verifyAPDU);
- byte sw1 = (byte) responseAPDU.getSW1();
- byte[] sw = new byte[] {
- (byte) (0xFF & responseAPDU.getSW1()),
- (byte) (0xFF & responseAPDU.getSW2()) };
-
- icc.endExclusive();
- return STATUS.ACTIV;
- } catch (CardException ex) {
- log.error("Failed to get PIN status: " + ex.getMessage());
- throw new SignatureCardException("Failed to get PIN status", ex);
- }
- }
-
-}
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
index 469af15f..e51044af 100644
--- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties
+++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties
@@ -15,10 +15,34 @@
title.activation=Aktivierung
title.pin.mgmt=PIN Verwaltung
-message.pin.mgmt=under construction
+title.activate.pin=PIN Aktivieren
+title.change.pin=PIN \u00C4ndern
+title.unblock.pin=PIN Entsperren
+
+message.pin.mgmt=Die Karte verf\u00FCgt \u00FCber {0} PINs
+message.activate.pin={0} eingeben und best\u00E4tigen
+message.change.pin={0} eingeben und best\u00E4tigen
+message.unblock.pin=PUK zu {0} eingeben
+
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
\ No newline at end of file
+button.unblock=Entsperren
+
+help.activation=help.activation
+help.pin.mgmt=help.pin.mgmt
+
+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.
+
+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
index 16ac7d0b..1cf4a102 100644
--- 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
@@ -13,12 +13,36 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-title.activation=Aktivation
+title.activation=Activation
title.pin.mgmt=PIN Management
-message.pin.mgmt=under construction
+title.activate.pin=Activate PIN
+title.change.pin=Change PIN
+title.unblock.pin=Unblock PIN
+
+message.pin.mgmt=The smartcard has {0} PINs
+message.activate.pin=Enter and confirm {0}
+message.change.pin=Enter and confirm {0}
+message.unblock.pin=Enter PUK for {0}
+
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
\ No newline at end of file
+button.unblock=Unblock
+
+help.activation=help.activation
+help.pin.mgmt=help.pin.mgmt
+
+err.activate=An error occured during activation of {0}.
+err.change=An error occured during changing of {0}.
+err.unblock=Unblocking of {0} 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/BKUGUIWorker.java b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index 669a63fc..ef8c87e4 100644
--- a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -25,8 +25,6 @@ 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.io.ByteArrayInputStream;
-import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
@@ -46,7 +44,7 @@ public class BKUGUIWorker implements Runnable {
public void run() {
try {
- final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN");
+ final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN", (byte)0x00, null);
final ActionListener cancelListener = new ActionListener() {
diff --git a/BKUAppletExt/src/test/resources/appletTest.html b/BKUAppletExt/src/test/resources/appletTest.html
index 9add4309..813ee1f0 100644
--- a/BKUAppletExt/src/test/resources/appletTest.html
+++ b/BKUAppletExt/src/test/resources/appletTest.html
@@ -19,7 +19,7 @@
+ width=270 height=180>
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 f564c07a..1d5a2cf4 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
@@ -38,9 +38,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.swing.CellRendererPane;
import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
@@ -51,7 +48,6 @@ import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JScrollPane;
import javax.swing.JTable;
-import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
@@ -1064,7 +1060,9 @@ public class BKUGUIImpl implements BKUGUIFacade {
@Override
public char[] getPin() {
if (pinField != null) {
- return pinField.getPassword();
+ char[] pin = pinField.getPassword();
+ pinField = null;
+ return pin;
}
return null;
}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java
index 2054ae86..87b636f0 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/PinDocument.java
@@ -22,6 +22,7 @@ import java.util.regex.Pattern;
import javax.swing.JButton;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
+import javax.swing.text.Document;
import javax.swing.text.PlainDocument;
/**
@@ -30,9 +31,10 @@ import javax.swing.text.PlainDocument;
*/
class PINDocument extends PlainDocument {
- private PINSpec pinSpec;
- private Pattern pinPattern;
- private JButton enterButton;
+ protected PINSpec pinSpec;
+ protected Pattern pinPattern;
+ protected JButton enterButton;
+ protected Document compareTo;
public PINDocument(PINSpec pinSpec, JButton enterButton) {
this.pinSpec = pinSpec;
@@ -44,6 +46,11 @@ class PINDocument extends PlainDocument {
this.enterButton = enterButton;
}
+ public PINDocument(PINSpec pinSpec, JButton enterButton, Document compareTo) {
+ this(pinSpec, enterButton);
+ this.compareTo = compareTo;
+ }
+
@Override
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
if (pinSpec.getMaxLength() < 0 || pinSpec.getMaxLength() >= (getLength() + str.length())) {
@@ -58,12 +65,23 @@ class PINDocument extends PlainDocument {
super.insertString(offs, str, a);
}
}
- enterButton.setEnabled(getLength() >= pinSpec.getMinLength());
+ if (enterButton != null) {
+ enterButton.setEnabled(getLength() >= pinSpec.getMinLength() && compare());
+ }
}
@Override
public void remove(int offs, int len) throws BadLocationException {
super.remove(offs, len);
- enterButton.setEnabled(getLength() >= pinSpec.getMinLength());
+ if (enterButton != null) {
+ enterButton.setEnabled(getLength() >= pinSpec.getMinLength() && compare());
+ }
+ }
+
+ private boolean compare() throws BadLocationException {
+ if (compareTo == null) {
+ return true;
+ }
+ return compareTo.getText(0, compareTo.getLength()).equals(getText(0, getLength()));
}
}
\ No newline at end of file
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index 8436a730..1e0bc9f5 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -20,7 +20,7 @@ title.cardnotsupported=Die Karte wird nicht unterst\u00FCtzt
title.cardpin=Karte wird gelesen
title.sign=Signatur erstellen
title.error=Fehler
-title.retry=Falscher PIN
+title.retry=Falsche PIN
title.wait=Bitte warten
title.hashdata=Signaturdaten
windowtitle.save=Signaturdaten speichern
@@ -84,7 +84,7 @@ help.cardnotsupported=Nicht unterst\u00FCtzte B\u00FCrgerkarte
help.insertcard=Keine B\u00FCrgerkarte im Kartenleser
help.cardpin=Pineingabe
help.signpin=Signatur-Pineingabe
-help.retry=Falscher Pin
+help.retry=Falsche Pin
help.hashdata=Signierte Inhalte
help.hashdatalist=Signierte Inhalte
help.hashdataviewer=Anzeige signierter Inhalte
\ No newline at end of file
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index 73aaab46..08ecaa7f 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -46,7 +46,7 @@ public class BKUGUIWorker implements Runnable {
public void run() {
// try {
- final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN");
+ final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN", (byte) 0x81, null);
final ActionListener cancelListener = new ActionListener() {
diff --git a/STALExt/src/main/java/at/gv/egiz/stal/ext/ActivatePINRequest.java b/STALExt/src/main/java/at/gv/egiz/stal/ext/ActivatePINRequest.java
deleted file mode 100644
index f2039388..00000000
--- a/STALExt/src/main/java/at/gv/egiz/stal/ext/ActivatePINRequest.java
+++ /dev/null
@@ -1,28 +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.stal.ext;
-
-import at.gv.egiz.stal.STALRequest;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class ActivatePINRequest extends STALRequest {
-
-}
diff --git a/STALExt/src/main/java/at/gv/egiz/stal/ext/ChangePINRequest.java b/STALExt/src/main/java/at/gv/egiz/stal/ext/ChangePINRequest.java
deleted file mode 100644
index ea508146..00000000
--- a/STALExt/src/main/java/at/gv/egiz/stal/ext/ChangePINRequest.java
+++ /dev/null
@@ -1,28 +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.stal.ext;
-
-import at.gv.egiz.stal.STALRequest;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class ChangePINRequest extends STALRequest {
-
-}
diff --git a/STALExt/src/main/java/at/gv/egiz/stal/ext/PINManagementRequest.java b/STALExt/src/main/java/at/gv/egiz/stal/ext/PINManagementRequest.java
new file mode 100644
index 00000000..87c53e24
--- /dev/null
+++ b/STALExt/src/main/java/at/gv/egiz/stal/ext/PINManagementRequest.java
@@ -0,0 +1,31 @@
+/*
+ * 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.stal.ext;
+
+import at.gv.egiz.stal.STALRequest;
+
+/**
+ * Dummy STAL request to trigger PIN Management. (no proper STAL requests
+ * for PIN activation, unblocking)
+ *
+ *
+ * @author Clemens Orthacker
+ */
+public class PINManagementRequest extends STALRequest {
+
+}
diff --git a/STALExt/src/main/java/at/gv/egiz/stal/ext/PINManagementResponse.java b/STALExt/src/main/java/at/gv/egiz/stal/ext/PINManagementResponse.java
new file mode 100644
index 00000000..b8b90604
--- /dev/null
+++ b/STALExt/src/main/java/at/gv/egiz/stal/ext/PINManagementResponse.java
@@ -0,0 +1,28 @@
+/*
+ * 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.stal.ext;
+
+import at.gv.egiz.stal.STALResponse;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class PINManagementResponse extends STALResponse {
+
+}
diff --git a/STALExt/src/main/java/at/gv/egiz/stal/ext/UnblockPINRequest.java b/STALExt/src/main/java/at/gv/egiz/stal/ext/UnblockPINRequest.java
deleted file mode 100644
index 543de31c..00000000
--- a/STALExt/src/main/java/at/gv/egiz/stal/ext/UnblockPINRequest.java
+++ /dev/null
@@ -1,28 +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.stal.ext;
-
-import at.gv.egiz.stal.STALRequest;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class UnblockPINRequest extends STALRequest {
-
-}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/DataObject.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/DataObject.java
index ae4918ce..b64306aa 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/DataObject.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/DataObject.java
@@ -14,98 +14,105 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package at.gv.egiz.bku.slcommands.impl.xsect;
-
-import iaik.xml.crypto.dom.DOMCryptoContext;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.SequenceInputStream;
-import java.io.StringWriter;
-import java.io.UnsupportedEncodingException;
-import java.net.URISyntaxException;
-import java.nio.charset.Charset;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.NoSuchAlgorithmException;
-import java.util.ArrayList;
+package at.gv.egiz.bku.slcommands.impl.xsect;
+
+import iaik.xml.crypto.dom.DOMCryptoContext;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.SequenceInputStream;
+import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.URISyntaxException;
+import java.nio.charset.Charset;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.NoSuchAlgorithmException;
+import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.crypto.MarshalException;
-import javax.xml.crypto.dom.DOMStructure;
-import javax.xml.crypto.dsig.CanonicalizationMethod;
-import javax.xml.crypto.dsig.DigestMethod;
-import javax.xml.crypto.dsig.Reference;
-import javax.xml.crypto.dsig.Transform;
-import javax.xml.crypto.dsig.XMLObject;
-import javax.xml.crypto.dsig.spec.TransformParameterSpec;
-import javax.xml.crypto.dsig.spec.XPathFilter2ParameterSpec;
-import javax.xml.crypto.dsig.spec.XPathType;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.w3c.dom.DOMConfiguration;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-import org.w3c.dom.bootstrap.DOMImplementationRegistry;
-import org.w3c.dom.ls.DOMImplementationLS;
-import org.w3c.dom.ls.LSException;
-import org.w3c.dom.ls.LSInput;
-import org.w3c.dom.ls.LSOutput;
-import org.w3c.dom.ls.LSParser;
-import org.w3c.dom.ls.LSSerializer;
-
-import at.buergerkarte.namespaces.securitylayer._1.Base64XMLLocRefOptRefContentType;
-import at.buergerkarte.namespaces.securitylayer._1.DataObjectInfoType;
-import at.buergerkarte.namespaces.securitylayer._1.MetaInfoType;
-import at.buergerkarte.namespaces.securitylayer._1.TransformsInfoType;
-import at.gv.egiz.bku.binding.HttpUtil;
-import at.gv.egiz.bku.slexceptions.SLCommandException;
-import at.gv.egiz.bku.slexceptions.SLRequestException;
-import at.gv.egiz.bku.slexceptions.SLRuntimeException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.crypto.MarshalException;
+import javax.xml.crypto.dom.DOMStructure;
+import javax.xml.crypto.dsig.CanonicalizationMethod;
+import javax.xml.crypto.dsig.DigestMethod;
+import javax.xml.crypto.dsig.Reference;
+import javax.xml.crypto.dsig.Transform;
+import javax.xml.crypto.dsig.XMLObject;
+import javax.xml.crypto.dsig.spec.TransformParameterSpec;
+import javax.xml.crypto.dsig.spec.XPathFilter2ParameterSpec;
+import javax.xml.crypto.dsig.spec.XPathType;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.w3._2000._09.xmldsig_.TransformType;
+import org.w3._2000._09.xmldsig_.TransformsType;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSException;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSOutput;
+import org.w3c.dom.ls.LSParser;
+import org.w3c.dom.ls.LSSerializer;
+
+import at.buergerkarte.namespaces.securitylayer._1.Base64XMLLocRefOptRefContentType;
+import at.buergerkarte.namespaces.securitylayer._1.DataObjectInfoType;
+import at.buergerkarte.namespaces.securitylayer._1.MetaInfoType;
+import at.buergerkarte.namespaces.securitylayer._1.TransformsInfoType;
+import at.gv.egiz.bku.binding.HttpUtil;
+import at.gv.egiz.bku.slexceptions.SLCommandException;
+import at.gv.egiz.bku.slexceptions.SLRequestException;
+import at.gv.egiz.bku.slexceptions.SLRuntimeException;
import at.gv.egiz.bku.slexceptions.SLViewerException;
-import at.gv.egiz.bku.utils.urldereferencer.StreamData;
-import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer;
+import at.gv.egiz.bku.utils.urldereferencer.StreamData;
+import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer;
import at.gv.egiz.bku.viewer.ValidationException;
import at.gv.egiz.bku.viewer.Validator;
import at.gv.egiz.bku.viewer.ValidatorFactory;
-import at.gv.egiz.dom.DOMUtils;
-import at.gv.egiz.slbinding.impl.XMLContentType;
-
-/**
- * This class represents a DataObject
of an XML-Signature
- * created by the security layer command CreateXMLSignature
.
- *
- * @author mcentner
- */
-public class DataObject {
-
- /**
- * Logging facility.
- */
- private static Log log = LogFactory.getLog(DataObject.class);
-
- /**
- * DOM Implementation.
- */
- private static final String DOM_LS_3_0 = "LS 3.0";
-
- /**
- * The array of the default preferred MIME type order.
- */
- private static final String[] DEFAULT_PREFFERED_MIME_TYPES =
- new String[] {
+import at.gv.egiz.dom.DOMUtils;
+import at.gv.egiz.marshal.NamespacePrefix;
+import at.gv.egiz.marshal.NamespacePrefixMapperImpl;
+import at.gv.egiz.slbinding.impl.XMLContentType;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+/**
+ * This class represents a DataObject
of an XML-Signature
+ * created by the security layer command CreateXMLSignature
.
+ *
+ * @author mcentner
+ */
+public class DataObject {
+
+ /**
+ * Logging facility.
+ */
+ private static Log log = LogFactory.getLog(DataObject.class);
+
+ /**
+ * DOM Implementation.
+ */
+ private static final String DOM_LS_3_0 = "LS 3.0";
+
+ /**
+ * The array of the default preferred MIME type order.
+ */
+ private static final String[] DEFAULT_PREFFERED_MIME_TYPES =
+ new String[] {
"text/plain",
- "application/xhtml+xml"
+ "application/xhtml+xml"
};
/**
@@ -149,87 +156,87 @@ public class DataObject {
validMimeTypes = mediaTypes;
}
- /**
- * The DOM implementation used.
- */
- private DOMImplementationLS domImplLS;
-
- /**
- * The signature context.
- */
- private SignatureContext ctx;
-
- /**
- * The Reference for this DataObject.
- */
- private XSECTReference reference;
-
- /**
- * The XMLObject for this DataObject.
- */
- private XMLObject xmlObject;
-
- /**
- * The MIME-Type of the digest input.
- */
- private String mimeType;
-
- /**
- * An optional description of the digest input.
- */
- private String description;
-
- /**
- * Creates a new instance.
- *
- * @param document the document of the target signature
- */
- public DataObject(SignatureContext signatureContext) {
- this.ctx = signatureContext;
-
- DOMImplementationRegistry registry;
- try {
- registry = DOMImplementationRegistry.newInstance();
- } catch (Exception e) {
- log.error("Failed to get DOMImplementationRegistry.", e);
- throw new SLRuntimeException("Failed to get DOMImplementationRegistry.");
- }
-
- domImplLS = (DOMImplementationLS) registry.getDOMImplementation(DOM_LS_3_0);
- if (domImplLS == null) {
- log.error("Failed to get DOMImplementation " + DOM_LS_3_0);
- throw new SLRuntimeException("Failed to get DOMImplementation " + DOM_LS_3_0);
- }
-
- }
-
- /**
- * @return the reference
- */
- public Reference getReference() {
- return reference;
- }
-
- /**
- * @return the xmlObject
- */
- public XMLObject getXmlObject() {
- return xmlObject;
- }
-
- /**
- * @return the mimeType
- */
- public String getMimeType() {
- return mimeType;
- }
-
- /**
- * @return the description
- */
- public String getDescription() {
- return description;
- }
+ /**
+ * The DOM implementation used.
+ */
+ private DOMImplementationLS domImplLS;
+
+ /**
+ * The signature context.
+ */
+ private SignatureContext ctx;
+
+ /**
+ * The Reference for this DataObject.
+ */
+ private XSECTReference reference;
+
+ /**
+ * The XMLObject for this DataObject.
+ */
+ private XMLObject xmlObject;
+
+ /**
+ * The MIME-Type of the digest input.
+ */
+ private String mimeType;
+
+ /**
+ * An optional description of the digest input.
+ */
+ private String description;
+
+ /**
+ * Creates a new instance.
+ *
+ * @param document the document of the target signature
+ */
+ public DataObject(SignatureContext signatureContext) {
+ this.ctx = signatureContext;
+
+ DOMImplementationRegistry registry;
+ try {
+ registry = DOMImplementationRegistry.newInstance();
+ } catch (Exception e) {
+ log.error("Failed to get DOMImplementationRegistry.", e);
+ throw new SLRuntimeException("Failed to get DOMImplementationRegistry.");
+ }
+
+ domImplLS = (DOMImplementationLS) registry.getDOMImplementation(DOM_LS_3_0);
+ if (domImplLS == null) {
+ log.error("Failed to get DOMImplementation " + DOM_LS_3_0);
+ throw new SLRuntimeException("Failed to get DOMImplementation " + DOM_LS_3_0);
+ }
+
+ }
+
+ /**
+ * @return the reference
+ */
+ public Reference getReference() {
+ return reference;
+ }
+
+ /**
+ * @return the xmlObject
+ */
+ public XMLObject getXmlObject() {
+ return xmlObject;
+ }
+
+ /**
+ * @return the mimeType
+ */
+ public String getMimeType() {
+ return mimeType;
+ }
+
+ /**
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
public void validateHashDataInput() throws SLViewerException {
@@ -293,823 +300,920 @@ public class DataObject {
}
}
-
- /**
- * Configures this DataObject with the information provided within the given
- * sl:DataObjectInfo
.
- *
- * @param dataObjectInfo
- * the sl:DataObjectInfo
- *
- * @throws SLCommandException
- * if configuring this DataObject with the information provided in
- * the sl:DataObjectInfo
fails.
- * @throws SLRequestException
- * if the information provided in the sl:DataObjectInfo
- * does not conform to the security layer specification.
- * @throws NullPointerException
- * if dataObjectInfo
is null
- */
- public void setDataObjectInfo(DataObjectInfoType dataObjectInfo) throws SLCommandException, SLRequestException {
-
- Base64XMLLocRefOptRefContentType dataObject = dataObjectInfo.getDataObject();
- String structure = dataObjectInfo.getStructure();
-
- // select and unmarshal an appropriate transformation path if provided
- // and set the final data meta information
- XSECTTransforms transforms = createTransformsAndSetFinalDataMetaInfo(dataObjectInfo.getTransformsInfo());
-
- if ("enveloping".equals(structure)) {
-
- // configure this DataObject as an enveloped DataObject
- setEnvelopedDataObject(dataObject, transforms);
-
- } else if ("detached".equals(structure)) {
-
- // configure this DataObject as an detached DataObject
- setDetachedDataObject(dataObject, transforms);
-
- }
- // other values are not allowed by the schema and are therefore ignored
-
- }
-
- /**
- * Configures this DataObject as an enveloped DataObject with the information
- * provided within the given sl:DataObject
.
- *
- * @param dataObject
- * the sl:DataObject
- * @param transforms
- * an optional Transforms
element (may be
- * null
)
- *
- * @throws SLCommandException
- * if configuring this DataObject with the information provided in
- * the sl:DataObject
fails.
- * @throws SLRequestException
- * if the information provided in the sl:DataObject
- * does not conform to the security layer specification.
- * @throws NullPointerException
- * if dataObject
is null
- */
- private void setEnvelopedDataObject(
- Base64XMLLocRefOptRefContentType dataObject, XSECTTransforms transforms)
- throws SLCommandException, SLRequestException {
-
- String reference = dataObject.getReference();
- if (reference == null) {
- //
- // case A
- //
- // The Reference attribute is not used; the content of sl:DataObject represents the data object.
- // If the data object is XML-coded (the sl:XMLContent element is used in sl:DataObject), then it
- // must be incorporated in the signature structure as parsed XML.
- //
-
- if (dataObject.getBase64Content() != null) {
-
- log.debug("Adding DataObject (Base64Content) without a reference URI.");
-
- // create XMLObject
- XMLObject xmlObject = createXMLObject(new ByteArrayInputStream(dataObject.getBase64Content()));
-
- setXMLObjectAndReferenceBase64(xmlObject, transforms);
-
- } else if (dataObject.getXMLContent() != null) {
-
- log.debug("Adding DataObject (XMLContent) without a reference URI.");
-
- // create XMLObject
- DocumentFragment content = parseDataObject((XMLContentType) dataObject.getXMLContent());
- XMLObject xmlObject = createXMLObject(content);
-
- setXMLObjectAndReferenceXML(xmlObject, transforms);
-
- } else if (dataObject.getLocRefContent() != null) {
-
- log.debug("Adding DataObject (LocRefContent) without a reference URI.");
-
- setEnvelopedDataObject(dataObject.getLocRefContent(), transforms);
-
- } else {
-
- // not allowed
- log.info("XML structure of the command request contains an " +
- "invalid combination of optional elements or attributes. " +
- "DataObject of structure='enveloped' without a reference must contain content.");
- throw new SLRequestException(3003);
-
- }
-
- } else {
-
- if (dataObject.getBase64Content() == null &&
- dataObject.getXMLContent() == null &&
- dataObject.getLocRefContent() == null) {
-
- //
- // case B
- //
- // The Reference attribute contains a URI that must be resolved by the
- // Citizen Card Environment to obtain the data object.
- // The content of sl:DataObject remains empty
- //
-
- log.debug("Adding DataObject from reference URI '" + reference + "'.");
-
- setEnvelopedDataObject(reference, transforms);
-
- } else {
-
- // not allowed
- log.info("XML structure of the command request contains an " +
- "invalid combination of optional elements or attributes. " +
- "DataObject of structure='enveloped' with reference must not contain content.");
- throw new SLRequestException(3003);
-
- }
-
-
- }
-
- }
-
- /**
- * Configures this DataObject as an enveloped DataObject with the content to
- * be dereferenced from the given reference
.
- *
- * @param reference
- * the reference
URI
- * @param transforms
- * an optional Transforms
element (may be
- * null
)
- *
- * @throws SLCommandException
- * if dereferencing the given reference
fails, or if
- * configuring this DataObject with the data dereferenced from the
- * given reference
fails.
- * @throws NullPointerException
- * if reference
is null
- */
- private void setEnvelopedDataObject(String reference, XSECTTransforms transforms) throws SLCommandException {
-
- if (reference == null) {
- throw new NullPointerException("Argument 'reference' must not be null.");
- }
-
- // dereference URL
- URLDereferencer dereferencer = URLDereferencer.getInstance();
-
- StreamData streamData;
- try {
- streamData = dereferencer.dereference(reference, ctx.getDereferencerContext());
- } catch (IOException e) {
- log.info("Failed to dereference XMLObject from '" + reference + "'.", e);
- throw new SLCommandException(4110);
- }
-
- Node childNode;
-
- String contentType = streamData.getContentType();
- if (contentType.startsWith("text/xml")) {
-
- // If content type is text/xml parse content.
- String charset = HttpUtil.getCharset(contentType, true);
-
- Document doc = parseDataObject(streamData.getStream(), charset);
-
- childNode = doc.getDocumentElement();
-
- if (childNode == null) {
- log.info("Failed to parse XMLObject from '" + reference + "'.");
- throw new SLCommandException(4111);
- }
-
- XMLObject xmlObject = createXMLObject(childNode);
-
- setXMLObjectAndReferenceXML(xmlObject, transforms);
-
- } else {
-
- // Include content Base64 encoded.
- XMLObject xmlObject = createXMLObject(streamData.getStream());
-
- setXMLObjectAndReferenceBase64(xmlObject, transforms);
-
- }
-
- }
-
- /**
- * Configures this DataObject as an detached DataObject with the information
- * provided in the given sl:DataObject
and optionally
- * transforms
.
- *
- * @param dataObject
- * the sl:DataObject
- * @param transforms
- * an optional Transforms object, may be null
- *
- * @throws SLCommandException
- * if configuring this DataObject with the information provided in
- * the sl:DataObject
fails.
- * @throws SLRequestException
- * if the information provided in the sl:DataObject
- * does not conform to the security layer specification.
- * @throws NullPointerException
- * if dataObject
is null
- */
- private void setDetachedDataObject(
- Base64XMLLocRefOptRefContentType dataObject, XSECTTransforms transforms)
- throws SLCommandException, SLRequestException {
-
- String referenceURI = dataObject.getReference();
-
- if (referenceURI == null) {
-
- // not allowed
- log.info("XML structure of the command request contains an " +
- "invalid combination of optional elements or attributes. " +
- "DataObject of structure='detached' must contain a reference.");
- throw new SLRequestException(3003);
-
- } else {
-
- DigestMethod dm;
- try {
- dm = ctx.getAlgorithmMethodFactory().createDigestMethod(ctx);
- } catch (NoSuchAlgorithmException e) {
- log.error("Failed to get DigestMethod.", e);
- throw new SLCommandException(4006);
- } catch (InvalidAlgorithmParameterException e) {
- log.error("Failed to get DigestMethod.", e);
- throw new SLCommandException(4006);
- }
-
- String idValue = ctx.getIdValueFactory().createIdValue("Reference");
-
- reference = new XSECTReference(referenceURI, dm, transforms, null, idValue);
-
- // case D:
- //
- // The Reference attribute contains a URI that is used by the Citizen Card
- // Environment to code the reference to the data object as part of the XML
- // signature (attribute URI in the dsig:Reference) element. The content of
- // sl:DataObject represents the data object.
-
- if (dataObject.getLocRefContent() != null) {
- String locRef = dataObject.getLocRefContent();
- try {
- this.reference.setDereferencer(new LocRefDereferencer(ctx.getDereferencerContext(), locRef));
- } catch (URISyntaxException e) {
- log.info("Invalid URI '" + locRef + "' in DataObject.", e);
- throw new SLCommandException(4003);
- } catch (IllegalArgumentException e) {
- log.info("LocRef URI of '" + locRef + "' not supported in DataObject. ", e);
- throw new SLCommandException(4003);
- }
- } else if (dataObject.getBase64Content() != null) {
- byte[] base64Content = dataObject.getBase64Content();
- this.reference.setDereferencer(new ByteArrayDereferencer(base64Content));
- } else if (dataObject.getXMLContent() != null) {
- XMLContentType xmlContent = (XMLContentType) dataObject.getXMLContent();
- byte[] bytes = xmlContent.getRedirectedStream().toByteArray();
- this.reference.setDereferencer(new ByteArrayDereferencer(bytes));
- } else {
-
- // case C:
- //
- // The Reference attribute contains a URI that must be resolved by the
- // Citizen Card Environment to obtain the data object. The Reference
- // attribute contains a URI that is used by the Citizen Card Environment
- // to code the reference to the data object as part of the XML signature
- // (attribute URI in the dsig:Reference) element. The content of
- // sl:DataObject remains empty.
-
- }
-
- }
- }
-
- /**
- * Returns the preferred sl:TransformInfo
from the given list of
- * transformInfos
, or null
if none of the given
- * transformInfos
is preferred over the others.
- *
- * @param transformsInfos
- * a list of sl:TransformInfo
s
- *
- * @return the selected sl:TransformInfo
or null
, if
- * none is preferred over the others
- */
- private TransformsInfoType selectPreferredTransformsInfo(List transformsInfos) {
-
- Map mimeTypes = new HashMap();
-
- StringBuilder debugString = null;
- if (log.isDebugEnabled()) {
- debugString = new StringBuilder();
- debugString.append("Got " + transformsInfos.size() + " TransformsInfo(s):");
- }
-
- for (TransformsInfoType transformsInfoType : transformsInfos) {
- MetaInfoType finalDataMetaInfo = transformsInfoType.getFinalDataMetaInfo();
- String mimeType = finalDataMetaInfo.getMimeType();
- String description = finalDataMetaInfo.getDescription();
- mimeTypes.put(mimeType, transformsInfoType);
- if (debugString != null) {
- debugString.append("\n FinalDataMetaInfo: MIME-Type=");
- debugString.append(mimeType);
- if (description != null) {
- debugString.append(" ");
- debugString.append(description);
- }
- }
- }
-
- if (debugString != null) {
- log.debug(debugString);
- }
-
- // look for preferred transform
- for (String mimeType : DEFAULT_PREFFERED_MIME_TYPES) {
- if (mimeTypes.containsKey(mimeType)) {
- return mimeTypes.get(mimeType);
- }
- }
-
- // no preferred transform
- return null;
-
- }
-
- /**
- * Create an instance of ds:Transforms
from the given
- * sl:TransformsInfo
.
- *
- * @param transformsInfo
- * the sl:TransformsInfo
- *
- * @return a corresponding unmarshalled ds:Transforms
, or
- * null
if the given sl:TransformsInfo
does
- * not contain a dsig:Transforms
element
- *
- * @throws SLRequestException
- * if the ds:Transforms
in the given
- * transformsInfo
are not valid or cannot be parsed.
- *
- * @throws MarshalException
- * if the ds:Transforms
in the given
- * transformsInfo
cannot be unmarshalled.
- */
- private XSECTTransforms createTransforms(TransformsInfoType transformsInfo) throws SLRequestException, MarshalException {
-
- ByteArrayOutputStream redirectedStream = ((at.gv.egiz.slbinding.impl.TransformsInfoType) transformsInfo).getRedirectedStream();
- byte[] transformBytes = (redirectedStream != null) ? redirectedStream.toByteArray() : null;
-
- if (transformBytes != null && transformBytes.length > 0) {
-
- // debug
- if (log.isTraceEnabled()) {
- StringBuilder sb = new StringBuilder();
- sb.append("Trying to parse transforms:\n");
- sb.append(new String(transformBytes, Charset.forName("UTF-8")));
- log.trace(sb);
- }
-
- DOMImplementationLS domImplLS = DOMUtils.getDOMImplementationLS();
- LSInput input = domImplLS.createLSInput();
- input.setByteStream(new ByteArrayInputStream(transformBytes));
-
- LSParser parser = domImplLS.createLSParser(
- DOMImplementationLS.MODE_SYNCHRONOUS, null);
- DOMConfiguration domConfig = parser.getDomConfig();
- SimpleDOMErrorHandler errorHandler = new SimpleDOMErrorHandler();
- domConfig.setParameter("error-handler", errorHandler);
- domConfig.setParameter("validate", Boolean.FALSE);
-
- Document document;
- try {
- document = parser.parse(input);
- } catch (DOMException e) {
- log.info("Failed to parse dsig:Transforms.", e);
- throw new SLRequestException(3002);
- } catch (LSException e) {
- log.info("Failed to parse dsig:Transforms.", e);
- throw new SLRequestException(3002);
- }
-
- // adopt ds:Transforms
- Element documentElement = document.getDocumentElement();
- Node adoptedTransforms = ctx.getDocument().adoptNode(documentElement);
-
- DOMCryptoContext context = new DOMCryptoContext();
-
- // unmarshall ds:Transforms
- return new XSECTTransforms(context, adoptedTransforms);
-
- } else {
- return null;
- }
-
- }
-
- /**
- * Sets the mimeType
and the description
value
- * for this DataObject.
- *
- * @param metaInfoType the sl:FinalMetaDataInfo
- *
- * @throws NullPointerException if metaInfoType
is null
- */
- private void setFinalDataMetaInfo(MetaInfoType metaInfoType) {
-
- this.mimeType = metaInfoType.getMimeType();
- this.description = metaInfoType.getDescription();
-
- }
-
- /**
- * Selects an appropriate transformation path (if present) from the given list
- * of sl:TransformInfos
, sets the corresponding final data meta info and
- * returns the corresponding unmarshalled ds:Transforms
.
- *
- * @param transformsInfos the sl:TransformInfos
- *
- * @return the unmarshalled ds:Transforms
, or null
if
- * no transformation path has been selected.
- *
- * @throws SLRequestException if the given list ds:TransformsInfo
contains
- * an invalid ds:Transforms
element, or no suitable transformation path
- * can be found.
- */
- private XSECTTransforms createTransformsAndSetFinalDataMetaInfo(
- List transformsInfos) throws SLRequestException {
-
- TransformsInfoType preferredTransformsInfo = selectPreferredTransformsInfo(transformsInfos);
- // try preferred transform
- if (preferredTransformsInfo != null) {
-
- try {
- XSECTTransforms transforms = createTransforms(preferredTransformsInfo);
- setFinalDataMetaInfo(preferredTransformsInfo.getFinalDataMetaInfo());
- return transforms;
- } catch (MarshalException e) {
-
- String mimeType = preferredTransformsInfo.getFinalDataMetaInfo().getMimeType();
- log.info("Failed to unmarshal preferred transformation path (MIME-Type="
- + mimeType + ").", e);
-
- }
-
- }
-
- // look for another suitable transformation path
- for (TransformsInfoType transformsInfoType : transformsInfos) {
-
- try {
- XSECTTransforms transforms = createTransforms(transformsInfoType);
- setFinalDataMetaInfo(transformsInfoType.getFinalDataMetaInfo());
- return transforms;
- } catch (MarshalException e) {
-
- String mimeType = transformsInfoType.getFinalDataMetaInfo().getMimeType();
- log.info("Failed to unmarshal transformation path (MIME-Type="
- + mimeType + ").", e);
- }
-
- }
-
- // no suitable transformation path found
- throw new SLRequestException(3003);
-
- }
-
- /**
- * Create an XMLObject with the Base64 encoding of the given
- * content
.
- *
- * @param content
- * the to-be Base64 encoded content
- * @return an XMLObject with the Base64 encoded content
- */
- private XMLObject createXMLObject(InputStream content) {
-
- Text textNode;
- try {
- textNode = at.gv.egiz.dom.DOMUtils.createBase64Text(content, ctx.getDocument());
- } catch (IOException e) {
- log.error(e);
- throw new SLRuntimeException(e);
- }
-
- DOMStructure structure = new DOMStructure(textNode);
-
- String idValue = ctx.getIdValueFactory().createIdValue("Object");
-
- return ctx.getSignatureFactory().newXMLObject(Collections.singletonList(structure), idValue, null, null);
-
- }
-
- /**
- * Create an XMLObject with the given content
node.
- *
- * @param content the content node
- *
- * @return an XMLObject with the given content
- */
- private XMLObject createXMLObject(Node content) {
-
- String idValue = ctx.getIdValueFactory().createIdValue("Object");
-
- List structures = Collections.singletonList(new DOMStructure(content));
-
- return ctx.getSignatureFactory().newXMLObject(structures, idValue, null, null);
-
- }
-
- /**
- * Sets the given xmlObject
and creates and sets a corresponding
- * Reference
.
- *
- * A transform to Base64-decode the xmlObject's content is inserted at the top
- * of to the optional transforms
if given, or to a newly created
- * Transforms
element if transforms
is
- * null
.
- *
- * @param xmlObject
- * the XMLObject
- * @param transforms
- * an optional Transforms
element (may be
- * null
)
- *
- * @throws SLCommandException
- * if creating the Reference fails
- * @throws NullPointerException
- * if xmlObject
is null
- */
- private void setXMLObjectAndReferenceBase64(XMLObject xmlObject, XSECTTransforms transforms) throws SLCommandException {
-
- // create reference URI
- //
- // NOTE: the ds:Object can be referenced directly, as the Base64 transform
- // operates on the text() of the input nodelist.
- //
- String referenceURI = "#" + xmlObject.getId();
-
- // create Base64 Transform
- Transform transform;
- try {
- transform = ctx.getSignatureFactory().newTransform(Transform.BASE64, (TransformParameterSpec) null);
- } catch (NoSuchAlgorithmException e) {
- // algorithm must be present
- throw new SLRuntimeException(e);
- } catch (InvalidAlgorithmParameterException e) {
- // algorithm does not take parameters
- throw new SLRuntimeException(e);
- }
-
- if (transforms == null) {
- transforms = new XSECTTransforms(Collections.singletonList(transform));
- } else {
- transforms.insertTransform(transform);
- }
-
- DigestMethod dm;
- try {
- dm = ctx.getAlgorithmMethodFactory().createDigestMethod(ctx);
- } catch (NoSuchAlgorithmException e) {
- log.error("Failed to get DigestMethod.", e);
- throw new SLCommandException(4006);
- } catch (InvalidAlgorithmParameterException e) {
- log.error("Failed to get DigestMethod.", e);
- throw new SLCommandException(4006);
- }
- String id = ctx.getIdValueFactory().createIdValue("Reference");
-
- this.xmlObject = xmlObject;
- this.reference = new XSECTReference(referenceURI, dm, transforms, null, id);
-
- }
-
- /**
- * Sets the given xmlObject
and creates and sets a corresponding
- * Reference
.
- *
- * A transform to select the xmlObject's content is inserted at the top of to
- * the optional transforms
if given, or to a newly created
- * Transforms
element if transforms
is
- * null
.
- *
- *
- * @param xmlObject
- * the XMLObject
- * @param transforms
- * an optional Transforms
element (may be
- * null
)
- *
- * @throws SLCommandException
- * if creating the Reference fails
- * @throws NullPointerException
- * if xmlObject
is null
- */
- private void setXMLObjectAndReferenceXML(XMLObject xmlObject, XSECTTransforms transforms) throws SLCommandException {
-
- // create reference URI
- String referenceURI = "#" + xmlObject.getId();
-
- // create Transform to select ds:Object's children
- Transform xpathTransform;
- Transform c14nTransform;
- try {
-
- XPathType xpath = new XPathType("id(\"" + xmlObject.getId() + "\")/node()", XPathType.Filter.INTERSECT);
- List xpaths = Collections.singletonList(xpath);
- XPathFilter2ParameterSpec params = new XPathFilter2ParameterSpec(xpaths);
-
- xpathTransform = ctx.getSignatureFactory().newTransform(Transform.XPATH2, params);
-
- // add exclusive canonicalization to avoid signing the namespace context of the ds:Object
- c14nTransform = ctx.getSignatureFactory().newTransform(CanonicalizationMethod.EXCLUSIVE, (TransformParameterSpec) null);
-
- } catch (NoSuchAlgorithmException e) {
- // algorithm must be present
- throw new SLRuntimeException(e);
- } catch (InvalidAlgorithmParameterException e) {
- // params must be appropriate
- throw new SLRuntimeException(e);
- }
-
- if (transforms == null) {
- List newTransfroms = new ArrayList();
- newTransfroms.add(xpathTransform);
- newTransfroms.add(c14nTransform);
- transforms = new XSECTTransforms(newTransfroms);
- } else {
- transforms.insertTransform(xpathTransform);
- }
-
- DigestMethod dm;
- try {
- dm = ctx.getAlgorithmMethodFactory().createDigestMethod(ctx);
- } catch (NoSuchAlgorithmException e) {
- log.error("Failed to get DigestMethod.", e);
- throw new SLCommandException(4006);
- } catch (InvalidAlgorithmParameterException e) {
- log.error("Failed to get DigestMethod.", e);
- throw new SLCommandException(4006);
- }
- String id = ctx.getIdValueFactory().createIdValue("Reference");
-
- this.xmlObject = xmlObject;
- this.reference = new XSECTReference(referenceURI, dm, transforms, null, id);
-
- }
-
- /**
- * Parses the given xmlContent
and returns a corresponding
- * document fragment.
- *
- *
- * The to-be parsed content is surrounded by ... elements to
- * allow for mixed (e.g. Text and Element) content in XMLContent.
- *
- *
- * @param xmlContent
- * the XMLContent to-be parsed
- *
- * @return a document fragment containing the parsed nodes
- *
- * @throws SLCommandException
- * if parsing the given xmlContent
fails
- *
- * @throws NullPointerException
- * if xmlContent
is null
- */
- private DocumentFragment parseDataObject(XMLContentType xmlContent) throws SLCommandException {
-
- ByteArrayOutputStream redirectedStream = xmlContent.getRedirectedStream();
-
- // Note: We can assume a fixed character encoding of UTF-8 for the
- // content of the redirect stream as the content has already been parsed
- // and serialized again to the redirect stream.
-
- List inputStreams = new ArrayList();
- try {
- // dummy start element
- inputStreams.add(new ByteArrayInputStream("".getBytes("UTF-8")));
-
- // content
- inputStreams.add(new ByteArrayInputStream(redirectedStream.toByteArray()));
-
- // dummy end element
- inputStreams.add(new ByteArrayInputStream(" ".getBytes("UTF-8")));
- } catch (UnsupportedEncodingException e) {
- throw new SLRuntimeException(e);
- }
-
- SequenceInputStream inputStream = new SequenceInputStream(Collections.enumeration(inputStreams));
-
- // parse DataObject
- Document doc = parseDataObject(inputStream, "UTF-8");
-
- Element documentElement = doc.getDocumentElement();
-
- if (documentElement == null ||
- !"dummy".equals(documentElement.getLocalName())) {
- log.info("Failed to parse DataObject XMLContent.");
- throw new SLCommandException(4111);
- }
-
- DocumentFragment fragment = doc.createDocumentFragment();
- while (documentElement.getFirstChild() != null) {
- fragment.appendChild(documentElement.getFirstChild());
- }
-
- // log parsed document
- if (log.isTraceEnabled()) {
-
- StringWriter writer = new StringWriter();
-
- writer.write("DataObject:\n");
-
- LSOutput output = domImplLS.createLSOutput();
- output.setCharacterStream(writer);
- output.setEncoding("UTF-8");
- LSSerializer serializer = domImplLS.createLSSerializer();
- serializer.getDomConfig().setParameter("xml-declaration", Boolean.FALSE);
- serializer.write(fragment, output);
-
- log.trace(writer.toString());
- }
-
- return fragment;
-
- }
-
- /**
- * Parses the given inputStream
using the given
- * encoding
and returns the parsed document.
- *
- * @param inputStream
- * the to-be parsed input
- *
- * @param encoding
- * the encoding to be used for parsing the given
- * inputStream
- *
- * @return the parsed document
- *
- * @throws SLCommandException
- * if parsing the inputStream
fails.
- *
- * @throws NullPointerException
- * if inputStram
is null
- */
- private Document parseDataObject(InputStream inputStream, String encoding) throws SLCommandException {
-
- LSInput input = domImplLS.createLSInput();
- input.setByteStream(inputStream);
-
- if (encoding != null) {
- input.setEncoding(encoding);
- }
-
- LSParser parser = domImplLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
- DOMConfiguration domConfig = parser.getDomConfig();
- SimpleDOMErrorHandler errorHandler = new SimpleDOMErrorHandler();
- domConfig.setParameter("error-handler", errorHandler);
- domConfig.setParameter("validate", Boolean.FALSE);
-
- Document doc;
- try {
- doc = parser.parse(input);
- } catch (DOMException e) {
- log.info("Existing XML document cannot be parsed.", e);
- throw new SLCommandException(4111);
- } catch (LSException e) {
- log.info("Existing XML document cannot be parsed. ", e);
- throw new SLCommandException(4111);
- }
-
- if (errorHandler.hasErrors()) {
- // log errors
- if (log.isInfoEnabled()) {
- List errorMessages = errorHandler.getErrorMessages();
- StringBuffer sb = new StringBuffer();
- for (String errorMessage : errorMessages) {
- sb.append(" ");
- sb.append(errorMessage);
- }
- log.info("Existing XML document cannot be parsed. " + sb.toString());
- }
- throw new SLCommandException(4111);
- }
-
- return doc;
-
- }
-
-
-}
+
+ /**
+ * Configures this DataObject with the information provided within the given
+ * sl:DataObjectInfo
.
+ *
+ * @param dataObjectInfo
+ * the sl:DataObjectInfo
+ *
+ * @throws SLCommandException
+ * if configuring this DataObject with the information provided in
+ * the sl:DataObjectInfo
fails.
+ * @throws SLRequestException
+ * if the information provided in the sl:DataObjectInfo
+ * does not conform to the security layer specification.
+ * @throws NullPointerException
+ * if dataObjectInfo
is null
+ */
+ public void setDataObjectInfo(DataObjectInfoType dataObjectInfo) throws SLCommandException, SLRequestException {
+
+ Base64XMLLocRefOptRefContentType dataObject = dataObjectInfo.getDataObject();
+ String structure = dataObjectInfo.getStructure();
+
+ // select and unmarshal an appropriate transformation path if provided
+ // and set the final data meta information
+ XSECTTransforms transforms = createTransformsAndSetFinalDataMetaInfo(dataObjectInfo.getTransformsInfo());
+
+ if ("enveloping".equals(structure)) {
+
+ // configure this DataObject as an enveloped DataObject
+ setEnvelopedDataObject(dataObject, transforms);
+
+ } else if ("detached".equals(structure)) {
+
+ // configure this DataObject as an detached DataObject
+ setDetachedDataObject(dataObject, transforms);
+
+ }
+ // other values are not allowed by the schema and are therefore ignored
+
+ }
+
+ private byte[] getTransformsBytes(at.gv.egiz.slbinding.impl.TransformsInfoType ti) {
+ return ti.getRedirectedStream().toByteArray();
+// byte[] transformsBytes = ti.getRedirectedStream().toByteArray();
+//
+// if (transformsBytes == null || transformsBytes.length == 0) {
+// return null;
+// }
+//
+// String dsigPrefix = ti.getNamespaceContext().getNamespaceURI("http://www.w3.org/2000/09/xmldsig#");
+// byte[] pre, post;
+// if (dsigPrefix == null) {
+// log.trace("XMLDSig not declared in outside dsig:Transforms");
+// pre = "".getBytes();
+// post = " ".getBytes();
+// } else {
+// log.trace("XMLDSig bound to prefix " + dsigPrefix);
+// pre = ("").getBytes();
+// post = " ".getBytes();
+// }
+//
+// byte[] workaround = new byte[pre.length + transformsBytes.length + post.length];
+// System.arraycopy(pre, 0, workaround, 0, pre.length);
+// System.arraycopy(transformsBytes, 0, workaround, pre.length, transformsBytes.length);
+// System.arraycopy(post, 0, workaround, pre.length + transformsBytes.length, post.length);
+// return workaround;
+ }
+
+ /**
+ * Configures this DataObject as an enveloped DataObject with the information
+ * provided within the given sl:DataObject
.
+ *
+ * @param dataObject
+ * the sl:DataObject
+ * @param transforms
+ * an optional Transforms
element (may be
+ * null
)
+ *
+ * @throws SLCommandException
+ * if configuring this DataObject with the information provided in
+ * the sl:DataObject
fails.
+ * @throws SLRequestException
+ * if the information provided in the sl:DataObject
+ * does not conform to the security layer specification.
+ * @throws NullPointerException
+ * if dataObject
is null
+ */
+ private void setEnvelopedDataObject(
+ Base64XMLLocRefOptRefContentType dataObject, XSECTTransforms transforms)
+ throws SLCommandException, SLRequestException {
+
+ String reference = dataObject.getReference();
+ if (reference == null) {
+ //
+ // case A
+ //
+ // The Reference attribute is not used; the content of sl:DataObject represents the data object.
+ // If the data object is XML-coded (the sl:XMLContent element is used in sl:DataObject), then it
+ // must be incorporated in the signature structure as parsed XML.
+ //
+
+ if (dataObject.getBase64Content() != null) {
+
+ log.debug("Adding DataObject (Base64Content) without a reference URI.");
+
+ // create XMLObject
+ XMLObject xmlObject = createXMLObject(new ByteArrayInputStream(dataObject.getBase64Content()));
+
+ setXMLObjectAndReferenceBase64(xmlObject, transforms);
+
+ } else if (dataObject.getXMLContent() != null) {
+
+ log.debug("Adding DataObject (XMLContent) without a reference URI.");
+
+ // create XMLObject
+ DocumentFragment content = parseDataObject((XMLContentType) dataObject.getXMLContent());
+ XMLObject xmlObject = createXMLObject(content);
+
+ setXMLObjectAndReferenceXML(xmlObject, transforms);
+
+ } else if (dataObject.getLocRefContent() != null) {
+
+ log.debug("Adding DataObject (LocRefContent) without a reference URI.");
+
+ setEnvelopedDataObject(dataObject.getLocRefContent(), transforms);
+
+ } else {
+
+ // not allowed
+ log.info("XML structure of the command request contains an " +
+ "invalid combination of optional elements or attributes. " +
+ "DataObject of structure='enveloped' without a reference must contain content.");
+ throw new SLRequestException(3003);
+
+ }
+
+ } else {
+
+ if (dataObject.getBase64Content() == null &&
+ dataObject.getXMLContent() == null &&
+ dataObject.getLocRefContent() == null) {
+
+ //
+ // case B
+ //
+ // The Reference attribute contains a URI that must be resolved by the
+ // Citizen Card Environment to obtain the data object.
+ // The content of sl:DataObject remains empty
+ //
+
+ log.debug("Adding DataObject from reference URI '" + reference + "'.");
+
+ setEnvelopedDataObject(reference, transforms);
+
+ } else {
+
+ // not allowed
+ log.info("XML structure of the command request contains an " +
+ "invalid combination of optional elements or attributes. " +
+ "DataObject of structure='enveloped' with reference must not contain content.");
+ throw new SLRequestException(3003);
+
+ }
+
+
+ }
+
+ }
+
+ /**
+ * Configures this DataObject as an enveloped DataObject with the content to
+ * be dereferenced from the given reference
.
+ *
+ * @param reference
+ * the reference
URI
+ * @param transforms
+ * an optional Transforms
element (may be
+ * null
)
+ *
+ * @throws SLCommandException
+ * if dereferencing the given reference
fails, or if
+ * configuring this DataObject with the data dereferenced from the
+ * given reference
fails.
+ * @throws NullPointerException
+ * if reference
is null
+ */
+ private void setEnvelopedDataObject(String reference, XSECTTransforms transforms) throws SLCommandException {
+
+ if (reference == null) {
+ throw new NullPointerException("Argument 'reference' must not be null.");
+ }
+
+ // dereference URL
+ URLDereferencer dereferencer = URLDereferencer.getInstance();
+
+ StreamData streamData;
+ try {
+ streamData = dereferencer.dereference(reference, ctx.getDereferencerContext());
+ } catch (IOException e) {
+ log.info("Failed to dereference XMLObject from '" + reference + "'.", e);
+ throw new SLCommandException(4110);
+ }
+
+ Node childNode;
+
+ String contentType = streamData.getContentType();
+ if (contentType.startsWith("text/xml")) {
+
+ // If content type is text/xml parse content.
+ String charset = HttpUtil.getCharset(contentType, true);
+
+ Document doc = parseDataObject(streamData.getStream(), charset);
+
+ childNode = doc.getDocumentElement();
+
+ if (childNode == null) {
+ log.info("Failed to parse XMLObject from '" + reference + "'.");
+ throw new SLCommandException(4111);
+ }
+
+ XMLObject xmlObject = createXMLObject(childNode);
+
+ setXMLObjectAndReferenceXML(xmlObject, transforms);
+
+ } else {
+
+ // Include content Base64 encoded.
+ XMLObject xmlObject = createXMLObject(streamData.getStream());
+
+ setXMLObjectAndReferenceBase64(xmlObject, transforms);
+
+ }
+
+ }
+
+ /**
+ * Configures this DataObject as an detached DataObject with the information
+ * provided in the given sl:DataObject
and optionally
+ * transforms
.
+ *
+ * @param dataObject
+ * the sl:DataObject
+ * @param transforms
+ * an optional Transforms object, may be null
+ *
+ * @throws SLCommandException
+ * if configuring this DataObject with the information provided in
+ * the sl:DataObject
fails.
+ * @throws SLRequestException
+ * if the information provided in the sl:DataObject
+ * does not conform to the security layer specification.
+ * @throws NullPointerException
+ * if dataObject
is null
+ */
+ private void setDetachedDataObject(
+ Base64XMLLocRefOptRefContentType dataObject, XSECTTransforms transforms)
+ throws SLCommandException, SLRequestException {
+
+ String referenceURI = dataObject.getReference();
+
+ if (referenceURI == null) {
+
+ // not allowed
+ log.info("XML structure of the command request contains an " +
+ "invalid combination of optional elements or attributes. " +
+ "DataObject of structure='detached' must contain a reference.");
+ throw new SLRequestException(3003);
+
+ } else {
+
+ DigestMethod dm;
+ try {
+ dm = ctx.getAlgorithmMethodFactory().createDigestMethod(ctx);
+ } catch (NoSuchAlgorithmException e) {
+ log.error("Failed to get DigestMethod.", e);
+ throw new SLCommandException(4006);
+ } catch (InvalidAlgorithmParameterException e) {
+ log.error("Failed to get DigestMethod.", e);
+ throw new SLCommandException(4006);
+ }
+
+ String idValue = ctx.getIdValueFactory().createIdValue("Reference");
+
+ reference = new XSECTReference(referenceURI, dm, transforms, null, idValue);
+
+ // case D:
+ //
+ // The Reference attribute contains a URI that is used by the Citizen Card
+ // Environment to code the reference to the data object as part of the XML
+ // signature (attribute URI in the dsig:Reference) element. The content of
+ // sl:DataObject represents the data object.
+
+ if (dataObject.getLocRefContent() != null) {
+ String locRef = dataObject.getLocRefContent();
+ try {
+ this.reference.setDereferencer(new LocRefDereferencer(ctx.getDereferencerContext(), locRef));
+ } catch (URISyntaxException e) {
+ log.info("Invalid URI '" + locRef + "' in DataObject.", e);
+ throw new SLCommandException(4003);
+ } catch (IllegalArgumentException e) {
+ log.info("LocRef URI of '" + locRef + "' not supported in DataObject. ", e);
+ throw new SLCommandException(4003);
+ }
+ } else if (dataObject.getBase64Content() != null) {
+ byte[] base64Content = dataObject.getBase64Content();
+ this.reference.setDereferencer(new ByteArrayDereferencer(base64Content));
+ } else if (dataObject.getXMLContent() != null) {
+ XMLContentType xmlContent = (XMLContentType) dataObject.getXMLContent();
+ byte[] bytes = xmlContent.getRedirectedStream().toByteArray();
+ this.reference.setDereferencer(new ByteArrayDereferencer(bytes));
+ } else {
+
+ // case C:
+ //
+ // The Reference attribute contains a URI that must be resolved by the
+ // Citizen Card Environment to obtain the data object. The Reference
+ // attribute contains a URI that is used by the Citizen Card Environment
+ // to code the reference to the data object as part of the XML signature
+ // (attribute URI in the dsig:Reference) element. The content of
+ // sl:DataObject remains empty.
+
+ }
+
+ }
+ }
+
+ /**
+ * Returns the preferred sl:TransformInfo
from the given list of
+ * transformInfos
, or null
if none of the given
+ * transformInfos
is preferred over the others.
+ *
+ * @param transformsInfos
+ * a list of sl:TransformInfo
s
+ *
+ * @return the selected sl:TransformInfo
or null
, if
+ * none is preferred over the others
+ */
+ private TransformsInfoType selectPreferredTransformsInfo(List transformsInfos) {
+
+ Map mimeTypes = new HashMap();
+
+ StringBuilder debugString = null;
+ if (log.isDebugEnabled()) {
+ debugString = new StringBuilder();
+ debugString.append("Got " + transformsInfos.size() + " TransformsInfo(s):");
+ }
+
+ for (TransformsInfoType transformsInfoType : transformsInfos) {
+ MetaInfoType finalDataMetaInfo = transformsInfoType.getFinalDataMetaInfo();
+ String mimeType = finalDataMetaInfo.getMimeType();
+ String description = finalDataMetaInfo.getDescription();
+ mimeTypes.put(mimeType, transformsInfoType);
+ if (debugString != null) {
+ debugString.append("\n FinalDataMetaInfo: MIME-Type=");
+ debugString.append(mimeType);
+ if (description != null) {
+ debugString.append(" ");
+ debugString.append(description);
+ }
+ }
+ }
+
+ if (debugString != null) {
+ log.debug(debugString);
+ }
+
+ // look for preferred transform
+ for (String mimeType : DEFAULT_PREFFERED_MIME_TYPES) {
+ if (mimeTypes.containsKey(mimeType)) {
+ return mimeTypes.get(mimeType);
+ }
+ }
+
+ // no preferred transform
+ return null;
+
+ }
+
+ /**
+ * Create an instance of ds:Transforms
from the given
+ * sl:TransformsInfo
.
+ *
+ * @param transformsInfo
+ * the sl:TransformsInfo
+ *
+ * @return a corresponding unmarshalled ds:Transforms
, or
+ * null
if the given sl:TransformsInfo
does
+ * not contain a dsig:Transforms
element
+ *
+ * @throws SLRequestException
+ * if the ds:Transforms
in the given
+ * transformsInfo
are not valid or cannot be parsed.
+ *
+ * @throws MarshalException
+ * if the ds:Transforms
in the given
+ * transformsInfo
cannot be unmarshalled.
+ */
+ private XSECTTransforms createTransforms(TransformsInfoType transformsInfo) throws SLRequestException, MarshalException {
+
+ byte[] transforms = getTransformsBytes((at.gv.egiz.slbinding.impl.TransformsInfoType) transformsInfo);
+
+ if (transforms != null && transforms.length > 0) {
+ // debug
+ if (log.isTraceEnabled()) {
+ StringBuilder sb = new StringBuilder();
+ sb.append("Trying to parse transforms:\n");
+ sb.append(new String(transforms, Charset.forName("UTF-8")));
+ log.trace(sb);
+ }
+
+ DOMImplementationLS domImplLS = DOMUtils.getDOMImplementationLS();
+ LSInput input = domImplLS.createLSInput();
+ input.setByteStream(new ByteArrayInputStream(transforms));
+
+ LSParser parser = domImplLS.createLSParser(
+ DOMImplementationLS.MODE_SYNCHRONOUS, null);
+ DOMConfiguration domConfig = parser.getDomConfig();
+ SimpleDOMErrorHandler errorHandler = new SimpleDOMErrorHandler();
+ domConfig.setParameter("error-handler", errorHandler);
+ domConfig.setParameter("validate", Boolean.FALSE);
+
+ Document document;
+ try {
+ document = parser.parse(input);
+ } catch (DOMException e) {
+ log.info("Failed to parse dsig:Transforms.", e);
+ throw new SLRequestException(3002);
+ } catch (LSException e) {
+ log.info("Failed to parse dsig:Transforms.", e);
+ throw new SLRequestException(3002);
+ }
+
+ // adopt ds:Transforms
+ Element transformsElt = document.getDocumentElement();
+ Node adoptedTransforms = ctx.getDocument().adoptNode(transformsElt);
+
+ DOMCryptoContext context = new DOMCryptoContext();
+
+ // unmarshall ds:Transforms
+ return new XSECTTransforms(context, adoptedTransforms);
+
+ } else {
+ return null;
+ }
+
+
+// TransformsType transformsType = transformsInfo.getTransforms();
+// if (transformsType == null) {
+// return null;
+// }
+// List transformList = transformsType.getTransform();
+//
+// DOMImplementationLS domImplLS = DOMUtils.getDOMImplementationLS();
+//// Document transformsDoc = ((DOMImplementation) domImplLS).createDocument("http://www.w3.org/2000/09/xmldsig#", "Transforms", null);
+//// Element transforms = transformsDoc.getDocumentElement();
+// Document transformsDoc = DOMUtils.createDocument();
+// Element transforms = transformsDoc.createElementNS(
+// "http://www.w3.org/2000/09/xmldsig#",
+// Signature.XMLDSIG_PREFIX + ":Transforms");
+// transformsDoc.appendChild(transforms);
+//
+// for (TransformType transformType : transformList) {
+// log.trace("found " + transformType.getClass().getName());
+// Element transform = transformsDoc.createElementNS(
+// "http://www.w3.org/2000/09/xmldsig#",
+// Signature.XMLDSIG_PREFIX + ":Transform");
+// String algorithm = transformType.getAlgorithm();
+// if (algorithm != null) {
+// log.trace("found algorithm " + algorithm);
+// transform.setAttribute("Algorithm", algorithm);
+// }
+//
+// at.gv.egiz.slbinding.impl.TransformType t = (at.gv.egiz.slbinding.impl.TransformType) transformType;
+// byte[] redirectedBytes = t.getRedirectedStream().toByteArray();
+// if (redirectedBytes != null && redirectedBytes.length > 0) {
+// if (log.isTraceEnabled()) {
+// StringBuilder sb = new StringBuilder();
+// sb.append("Trying to parse dsig:Transform:\n");
+// sb.append(new String(redirectedBytes, Charset.forName("UTF-8")));
+// log.trace(sb);
+// }
+// LSInput input = domImplLS.createLSInput();
+// input.setByteStream(new ByteArrayInputStream(redirectedBytes));
+//
+// LSParser parser = domImplLS.createLSParser(
+// DOMImplementationLS.MODE_SYNCHRONOUS, null);
+// DOMConfiguration domConfig = parser.getDomConfig();
+// SimpleDOMErrorHandler errorHandler = new SimpleDOMErrorHandler();
+// domConfig.setParameter("error-handler", errorHandler);
+// domConfig.setParameter("validate", Boolean.FALSE);
+//
+// try {
+// Document redirectedDoc = parser.parse(input);
+// Node redirected = transformsDoc.adoptNode(redirectedDoc.getDocumentElement());
+// transform.appendChild(redirected);
+//
+// //not supported by Xerces2.9.1
+//// Node redirected = parser.parseWithContext(input, transform, LSParser.ACTION_APPEND_AS_CHILDREN);
+//
+// } catch (DOMException e) {
+// log.info("Failed to parse dsig:Transform.", e);
+// throw new SLRequestException(3002);
+// } catch (LSException e) {
+// log.info("Failed to parse dsig:Transform.", e);
+// throw new SLRequestException(3002);
+// }
+// }
+// transforms.appendChild(transform);
+// }
+//
+// //adopt ds:Transforms
+// Node adoptedTransforms = ctx.getDocument().adoptNode(transforms);
+// DOMCryptoContext context = new DOMCryptoContext();
+//
+// // unmarshall ds:Transforms
+// return new XSECTTransforms(context, adoptedTransforms);
+
+ }
+
+ /**
+ * Sets the mimeType
and the description
value
+ * for this DataObject.
+ *
+ * @param metaInfoType the sl:FinalMetaDataInfo
+ *
+ * @throws NullPointerException if metaInfoType
is null
+ */
+ private void setFinalDataMetaInfo(MetaInfoType metaInfoType) {
+
+ this.mimeType = metaInfoType.getMimeType();
+ this.description = metaInfoType.getDescription();
+
+ }
+
+ /**
+ * Selects an appropriate transformation path (if present) from the given list
+ * of sl:TransformInfos
, sets the corresponding final data meta info and
+ * returns the corresponding unmarshalled ds:Transforms
.
+ *
+ * @param transformsInfos the sl:TransformInfos
+ *
+ * @return the unmarshalled ds:Transforms
, or null
if
+ * no transformation path has been selected.
+ *
+ * @throws SLRequestException if the given list ds:TransformsInfo
contains
+ * an invalid ds:Transforms
element, or no suitable transformation path
+ * can be found.
+ */
+ private XSECTTransforms createTransformsAndSetFinalDataMetaInfo(
+ List transformsInfos) throws SLRequestException {
+
+ TransformsInfoType preferredTransformsInfo = selectPreferredTransformsInfo(transformsInfos);
+ // try preferred transform
+ if (preferredTransformsInfo != null) {
+
+ try {
+ XSECTTransforms transforms = createTransforms(preferredTransformsInfo);
+ setFinalDataMetaInfo(preferredTransformsInfo.getFinalDataMetaInfo());
+ return transforms;
+ } catch (MarshalException e) {
+
+ String mimeType = preferredTransformsInfo.getFinalDataMetaInfo().getMimeType();
+ log.info("Failed to unmarshal preferred transformation path (MIME-Type="
+ + mimeType + ").", e);
+
+ }
+
+ }
+
+ // look for another suitable transformation path
+ for (TransformsInfoType transformsInfoType : transformsInfos) {
+
+ try {
+ XSECTTransforms transforms = createTransforms(transformsInfoType);
+ setFinalDataMetaInfo(transformsInfoType.getFinalDataMetaInfo());
+ return transforms;
+ } catch (MarshalException e) {
+
+ String mimeType = transformsInfoType.getFinalDataMetaInfo().getMimeType();
+ log.info("Failed to unmarshal transformation path (MIME-Type="
+ + mimeType + ").", e);
+ }
+
+ }
+
+ // no suitable transformation path found
+ throw new SLRequestException(3003);
+
+ }
+
+ /**
+ * Create an XMLObject with the Base64 encoding of the given
+ * content
.
+ *
+ * @param content
+ * the to-be Base64 encoded content
+ * @return an XMLObject with the Base64 encoded content
+ */
+ private XMLObject createXMLObject(InputStream content) {
+
+ Text textNode;
+ try {
+ textNode = at.gv.egiz.dom.DOMUtils.createBase64Text(content, ctx.getDocument());
+ } catch (IOException e) {
+ log.error(e);
+ throw new SLRuntimeException(e);
+ }
+
+ DOMStructure structure = new DOMStructure(textNode);
+
+ String idValue = ctx.getIdValueFactory().createIdValue("Object");
+
+ return ctx.getSignatureFactory().newXMLObject(Collections.singletonList(structure), idValue, null, null);
+
+ }
+
+ /**
+ * Create an XMLObject with the given content
node.
+ *
+ * @param content the content node
+ *
+ * @return an XMLObject with the given content
+ */
+ private XMLObject createXMLObject(Node content) {
+
+ String idValue = ctx.getIdValueFactory().createIdValue("Object");
+
+ List structures = Collections.singletonList(new DOMStructure(content));
+
+ return ctx.getSignatureFactory().newXMLObject(structures, idValue, null, null);
+
+ }
+
+ /**
+ * Sets the given xmlObject
and creates and sets a corresponding
+ * Reference
.
+ *
+ * A transform to Base64-decode the xmlObject's content is inserted at the top
+ * of to the optional transforms
if given, or to a newly created
+ * Transforms
element if transforms
is
+ * null
.
+ *
+ * @param xmlObject
+ * the XMLObject
+ * @param transforms
+ * an optional Transforms
element (may be
+ * null
)
+ *
+ * @throws SLCommandException
+ * if creating the Reference fails
+ * @throws NullPointerException
+ * if xmlObject
is null
+ */
+ private void setXMLObjectAndReferenceBase64(XMLObject xmlObject, XSECTTransforms transforms) throws SLCommandException {
+
+ // create reference URI
+ //
+ // NOTE: the ds:Object can be referenced directly, as the Base64 transform
+ // operates on the text() of the input nodelist.
+ //
+ String referenceURI = "#" + xmlObject.getId();
+
+ // create Base64 Transform
+ Transform transform;
+ try {
+ transform = ctx.getSignatureFactory().newTransform(Transform.BASE64, (TransformParameterSpec) null);
+ } catch (NoSuchAlgorithmException e) {
+ // algorithm must be present
+ throw new SLRuntimeException(e);
+ } catch (InvalidAlgorithmParameterException e) {
+ // algorithm does not take parameters
+ throw new SLRuntimeException(e);
+ }
+
+ if (transforms == null) {
+ transforms = new XSECTTransforms(Collections.singletonList(transform));
+ } else {
+ transforms.insertTransform(transform);
+ }
+
+ DigestMethod dm;
+ try {
+ dm = ctx.getAlgorithmMethodFactory().createDigestMethod(ctx);
+ } catch (NoSuchAlgorithmException e) {
+ log.error("Failed to get DigestMethod.", e);
+ throw new SLCommandException(4006);
+ } catch (InvalidAlgorithmParameterException e) {
+ log.error("Failed to get DigestMethod.", e);
+ throw new SLCommandException(4006);
+ }
+ String id = ctx.getIdValueFactory().createIdValue("Reference");
+
+ this.xmlObject = xmlObject;
+ this.reference = new XSECTReference(referenceURI, dm, transforms, null, id);
+
+ }
+
+ /**
+ * Sets the given xmlObject
and creates and sets a corresponding
+ * Reference
.
+ *
+ * A transform to select the xmlObject's content is inserted at the top of to
+ * the optional transforms
if given, or to a newly created
+ * Transforms
element if transforms
is
+ * null
.
+ *
+ *
+ * @param xmlObject
+ * the XMLObject
+ * @param transforms
+ * an optional Transforms
element (may be
+ * null
)
+ *
+ * @throws SLCommandException
+ * if creating the Reference fails
+ * @throws NullPointerException
+ * if xmlObject
is null
+ */
+ private void setXMLObjectAndReferenceXML(XMLObject xmlObject, XSECTTransforms transforms) throws SLCommandException {
+
+ // create reference URI
+ String referenceURI = "#" + xmlObject.getId();
+
+ // create Transform to select ds:Object's children
+ Transform xpathTransform;
+ Transform c14nTransform;
+ try {
+
+ XPathType xpath = new XPathType("id(\"" + xmlObject.getId() + "\")/node()", XPathType.Filter.INTERSECT);
+ List xpaths = Collections.singletonList(xpath);
+ XPathFilter2ParameterSpec params = new XPathFilter2ParameterSpec(xpaths);
+
+ xpathTransform = ctx.getSignatureFactory().newTransform(Transform.XPATH2, params);
+
+ // add exclusive canonicalization to avoid signing the namespace context of the ds:Object
+ c14nTransform = ctx.getSignatureFactory().newTransform(CanonicalizationMethod.EXCLUSIVE, (TransformParameterSpec) null);
+
+ } catch (NoSuchAlgorithmException e) {
+ // algorithm must be present
+ throw new SLRuntimeException(e);
+ } catch (InvalidAlgorithmParameterException e) {
+ // params must be appropriate
+ throw new SLRuntimeException(e);
+ }
+
+ if (transforms == null) {
+ List newTransfroms = new ArrayList();
+ newTransfroms.add(xpathTransform);
+ newTransfroms.add(c14nTransform);
+ transforms = new XSECTTransforms(newTransfroms);
+ } else {
+ transforms.insertTransform(xpathTransform);
+ }
+
+ DigestMethod dm;
+ try {
+ dm = ctx.getAlgorithmMethodFactory().createDigestMethod(ctx);
+ } catch (NoSuchAlgorithmException e) {
+ log.error("Failed to get DigestMethod.", e);
+ throw new SLCommandException(4006);
+ } catch (InvalidAlgorithmParameterException e) {
+ log.error("Failed to get DigestMethod.", e);
+ throw new SLCommandException(4006);
+ }
+ String id = ctx.getIdValueFactory().createIdValue("Reference");
+
+ this.xmlObject = xmlObject;
+ this.reference = new XSECTReference(referenceURI, dm, transforms, null, id);
+
+ }
+
+ /**
+ * Parses the given xmlContent
and returns a corresponding
+ * document fragment.
+ *
+ *
+ * The to-be parsed content is surrounded by ... elements to
+ * allow for mixed (e.g. Text and Element) content in XMLContent.
+ *
+ *
+ * @param xmlContent
+ * the XMLContent to-be parsed
+ *
+ * @return a document fragment containing the parsed nodes
+ *
+ * @throws SLCommandException
+ * if parsing the given xmlContent
fails
+ *
+ * @throws NullPointerException
+ * if xmlContent
is null
+ */
+ private DocumentFragment parseDataObject(XMLContentType xmlContent) throws SLCommandException {
+
+ ByteArrayOutputStream redirectedStream = xmlContent.getRedirectedStream();
+
+ // Note: We can assume a fixed character encoding of UTF-8 for the
+ // content of the redirect stream as the content has already been parsed
+ // and serialized again to the redirect stream.
+
+ List inputStreams = new ArrayList();
+ try {
+ // dummy start element
+ inputStreams.add(new ByteArrayInputStream("".getBytes("UTF-8")));
+
+ // content
+ inputStreams.add(new ByteArrayInputStream(redirectedStream.toByteArray()));
+
+ // dummy end element
+ inputStreams.add(new ByteArrayInputStream(" ".getBytes("UTF-8")));
+ } catch (UnsupportedEncodingException e) {
+ throw new SLRuntimeException(e);
+ }
+
+ SequenceInputStream inputStream = new SequenceInputStream(Collections.enumeration(inputStreams));
+
+ // parse DataObject
+ Document doc = parseDataObject(inputStream, "UTF-8");
+
+ Element documentElement = doc.getDocumentElement();
+
+ if (documentElement == null ||
+ !"dummy".equals(documentElement.getLocalName())) {
+ log.info("Failed to parse DataObject XMLContent.");
+ throw new SLCommandException(4111);
+ }
+
+ DocumentFragment fragment = doc.createDocumentFragment();
+ while (documentElement.getFirstChild() != null) {
+ fragment.appendChild(documentElement.getFirstChild());
+ }
+
+ // log parsed document
+ if (log.isTraceEnabled()) {
+
+ StringWriter writer = new StringWriter();
+
+ writer.write("DataObject:\n");
+
+ LSOutput output = domImplLS.createLSOutput();
+ output.setCharacterStream(writer);
+ output.setEncoding("UTF-8");
+ LSSerializer serializer = domImplLS.createLSSerializer();
+ serializer.getDomConfig().setParameter("xml-declaration", Boolean.FALSE);
+ serializer.write(fragment, output);
+
+ log.trace(writer.toString());
+ }
+
+ return fragment;
+
+ }
+
+ /**
+ * Parses the given inputStream
using the given
+ * encoding
and returns the parsed document.
+ *
+ * @param inputStream
+ * the to-be parsed input
+ *
+ * @param encoding
+ * the encoding to be used for parsing the given
+ * inputStream
+ *
+ * @return the parsed document
+ *
+ * @throws SLCommandException
+ * if parsing the inputStream
fails.
+ *
+ * @throws NullPointerException
+ * if inputStram
is null
+ */
+ private Document parseDataObject(InputStream inputStream, String encoding) throws SLCommandException {
+
+ LSInput input = domImplLS.createLSInput();
+ input.setByteStream(inputStream);
+
+ if (encoding != null) {
+ input.setEncoding(encoding);
+ }
+
+ LSParser parser = domImplLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
+ DOMConfiguration domConfig = parser.getDomConfig();
+ SimpleDOMErrorHandler errorHandler = new SimpleDOMErrorHandler();
+ domConfig.setParameter("error-handler", errorHandler);
+ domConfig.setParameter("validate", Boolean.FALSE);
+
+ Document doc;
+ try {
+ doc = parser.parse(input);
+ } catch (DOMException e) {
+ log.info("Existing XML document cannot be parsed.", e);
+ throw new SLCommandException(4111);
+ } catch (LSException e) {
+ log.info("Existing XML document cannot be parsed. ", e);
+ throw new SLCommandException(4111);
+ }
+
+ if (errorHandler.hasErrors()) {
+ // log errors
+ if (log.isInfoEnabled()) {
+ List errorMessages = errorHandler.getErrorMessages();
+ StringBuffer sb = new StringBuffer();
+ for (String errorMessage : errorMessages) {
+ sb.append(" ");
+ sb.append(errorMessage);
+ }
+ log.info("Existing XML document cannot be parsed. " + sb.toString());
+ }
+ throw new SLCommandException(4111);
+ }
+
+ return doc;
+
+ }
+
+
+}
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java
index 8baa0137..9182e824 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/Signature.java
@@ -87,6 +87,8 @@ import at.gv.egiz.bku.utils.urldereferencer.StreamData;
import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer;
import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerContext;
import at.gv.egiz.dom.DOMUtils;
+import at.gv.egiz.marshal.NamespacePrefix;
+import at.gv.egiz.marshal.NamespacePrefixMapperImpl;
import at.gv.egiz.slbinding.impl.XMLContentType;
import at.gv.egiz.stal.STAL;
import at.gv.egiz.xades.QualifyingPropertiesException;
@@ -99,6 +101,7 @@ import at.gv.egiz.xades.QualifyingPropertiesFactory;
* @author mcentner
*/
public class Signature {
+ public static final String XMLDSIG_PREFIX = "dsig";
/**
* Logging facility.
@@ -407,7 +410,7 @@ public class Signature {
signContext.setProperty("javax.xml.crypto.dsig.cacheReference", Boolean.TRUE);
- signContext.putNamespacePrefix(XMLSignature.XMLNS, "dsig");
+ signContext.putNamespacePrefix(XMLSignature.XMLNS,XMLDSIG_PREFIX);
signContext.setURIDereferencer(new URIDereferncerAdapter(ctx.getDereferencerContext()));
diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureTest.java
index 78172dcb..7ce7b42d 100644
--- a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureTest.java
+++ b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/xsect/SignatureTest.java
@@ -14,185 +14,186 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package at.gv.egiz.bku.slcommands.impl.xsect;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import iaik.xml.crypto.XSecProvider;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.UnrecoverableKeyException;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.List;
-
+package at.gv.egiz.bku.slcommands.impl.xsect;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import iaik.xml.crypto.XSecProvider;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.List;
+
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSocketFactory;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import javax.xml.crypto.MarshalException;
-import javax.xml.crypto.dsig.CanonicalizationMethod;
-import javax.xml.crypto.dsig.DigestMethod;
-import javax.xml.crypto.dsig.Reference;
-import javax.xml.crypto.dsig.SignatureMethod;
-import javax.xml.crypto.dsig.Transform;
-import javax.xml.crypto.dsig.XMLObject;
-import javax.xml.crypto.dsig.XMLSignatureException;
-import javax.xml.crypto.dsig.XMLSignatureFactory;
-import javax.xml.crypto.dsig.dom.DOMSignContext;
-import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
-import javax.xml.crypto.dsig.spec.DigestMethodParameterSpec;
-import javax.xml.crypto.dsig.spec.SignatureMethodParameterSpec;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.ls.DOMImplementationLS;
-import org.w3c.dom.ls.LSOutput;
-import org.w3c.dom.ls.LSSerializer;
-
-import at.buergerkarte.namespaces.securitylayer._1.CreateXMLSignatureRequestType;
-import at.buergerkarte.namespaces.securitylayer._1.DataObjectInfoType;
-import at.buergerkarte.namespaces.securitylayer._1.ObjectFactory;
-import at.buergerkarte.namespaces.securitylayer._1.SignatureInfoCreationType;
-import at.gv.egiz.bku.slexceptions.SLCommandException;
-import at.gv.egiz.bku.slexceptions.SLRequestException;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+import javax.xml.crypto.MarshalException;
+import javax.xml.crypto.dsig.CanonicalizationMethod;
+import javax.xml.crypto.dsig.DigestMethod;
+import javax.xml.crypto.dsig.Reference;
+import javax.xml.crypto.dsig.SignatureMethod;
+import javax.xml.crypto.dsig.Transform;
+import javax.xml.crypto.dsig.XMLObject;
+import javax.xml.crypto.dsig.XMLSignatureException;
+import javax.xml.crypto.dsig.XMLSignatureFactory;
+import javax.xml.crypto.dsig.dom.DOMSignContext;
+import javax.xml.crypto.dsig.spec.C14NMethodParameterSpec;
+import javax.xml.crypto.dsig.spec.DigestMethodParameterSpec;
+import javax.xml.crypto.dsig.spec.SignatureMethodParameterSpec;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSOutput;
+import org.w3c.dom.ls.LSSerializer;
+
+import at.buergerkarte.namespaces.securitylayer._1.CreateXMLSignatureRequestType;
+import at.buergerkarte.namespaces.securitylayer._1.DataObjectInfoType;
+import at.buergerkarte.namespaces.securitylayer._1.ObjectFactory;
+import at.buergerkarte.namespaces.securitylayer._1.SignatureInfoCreationType;
+import at.gv.egiz.bku.slexceptions.SLCommandException;
+import at.gv.egiz.bku.slexceptions.SLRequestException;
import at.gv.egiz.bku.slexceptions.SLViewerException;
-import at.gv.egiz.bku.utils.urldereferencer.StreamData;
-import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer;
-import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerContext;
-import at.gv.egiz.bku.utils.urldereferencer.URLProtocolHandler;
-import at.gv.egiz.dom.DOMUtils;
-import at.gv.egiz.slbinding.RedirectEventFilter;
-import at.gv.egiz.slbinding.RedirectUnmarshallerListener;
-
-public class SignatureTest {
-
- private class AlgorithmMethodFactoryImpl implements AlgorithmMethodFactory {
-
- @Override
- public CanonicalizationMethod createCanonicalizationMethod(
- SignatureContext signatureContext) {
-
- XMLSignatureFactory signatureFactory = signatureContext.getSignatureFactory();
-
- try {
- return signatureFactory.newCanonicalizationMethod(CanonicalizationMethod.EXCLUSIVE, (C14NMethodParameterSpec) null);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public DigestMethod createDigestMethod(SignatureContext signatureContext) {
-
- XMLSignatureFactory signatureFactory = signatureContext.getSignatureFactory();
-
- try {
- return signatureFactory.newDigestMethod(DigestMethod.SHA1, (DigestMethodParameterSpec) null);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public SignatureMethod createSignatureMethod(
- SignatureContext signatureContext) {
-
- XMLSignatureFactory signatureFactory = signatureContext.getSignatureFactory();
-
- try {
- return signatureFactory.newSignatureMethod(SignatureMethod.RSA_SHA1, (SignatureMethodParameterSpec) null);
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
-
- }
-
- }
-
- private static final String RESOURCE_PREFIX = "at/gv/egiz/bku/slcommands/impl/";
-
- private static Unmarshaller unmarshaller;
-
- private static PrivateKey privateKey;
-
- private static X509Certificate certificate;
-
- @BeforeClass
- public static void setUpClass() throws JAXBException, NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException, UnrecoverableKeyException {
-
- XSecProvider.addAsProvider(true);
-
- String packageName = ObjectFactory.class.getPackage().getName();
- packageName += ":"
- + org.w3._2000._09.xmldsig_.ObjectFactory.class.getPackage().getName();
- JAXBContext jaxbContext = JAXBContext.newInstance(packageName);
-
- unmarshaller = jaxbContext.createUnmarshaller();
-
- initURLDereferencer();
-
- ClassLoader classLoader = SignatureTest.class.getClassLoader();
- InputStream certStream = classLoader.getResourceAsStream(RESOURCE_PREFIX + "Cert.p12");
- assertNotNull("Certificate not found.", certStream);
-
- char[] passwd = "1622".toCharArray();
-
- KeyStore keystore = KeyStore.getInstance("PKCS12");
- keystore.load(certStream, passwd);
- String firstAlias = keystore.aliases().nextElement();
- certificate = (X509Certificate) keystore.getCertificate(firstAlias);
- privateKey = (PrivateKey) keystore.getKey(firstAlias, passwd);
-
- }
-
- private static void initURLDereferencer() {
-
- URLDereferencer.getInstance().registerHandler("testlocal", new URLProtocolHandler() {
-
- @Override
- public StreamData dereference(String url, URLDereferencerContext context)
- throws IOException {
-
- ClassLoader classLoader = SignatureTest.class.getClassLoader();
-
- String filename = url.split(":", 2)[1];
-
- InputStream stream = classLoader.getResourceAsStream(RESOURCE_PREFIX + filename);
-
- if (stream == null) {
-
- throw new IOException("Failed to resolve resource '" + url + "'.");
-
- } else {
-
- String contentType;
- if (filename.endsWith(".xml")) {
- contentType = "text/xml";
- } else if (filename.endsWith(".txt")) {
- contentType = "text/plain";
- } else {
- contentType = "";
- }
-
- return new StreamData(url, contentType, stream);
-
- }
-
+import at.gv.egiz.bku.utils.urldereferencer.StreamData;
+import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer;
+import at.gv.egiz.bku.utils.urldereferencer.URLDereferencerContext;
+import at.gv.egiz.bku.utils.urldereferencer.URLProtocolHandler;
+import at.gv.egiz.dom.DOMUtils;
+import at.gv.egiz.slbinding.RedirectEventFilter;
+import at.gv.egiz.slbinding.RedirectUnmarshallerListener;
+import org.junit.Ignore;
+
+public class SignatureTest {
+
+ private class AlgorithmMethodFactoryImpl implements AlgorithmMethodFactory {
+
+ @Override
+ public CanonicalizationMethod createCanonicalizationMethod(
+ SignatureContext signatureContext) {
+
+ XMLSignatureFactory signatureFactory = signatureContext.getSignatureFactory();
+
+ try {
+ return signatureFactory.newCanonicalizationMethod(CanonicalizationMethod.EXCLUSIVE, (C14NMethodParameterSpec) null);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public DigestMethod createDigestMethod(SignatureContext signatureContext) {
+
+ XMLSignatureFactory signatureFactory = signatureContext.getSignatureFactory();
+
+ try {
+ return signatureFactory.newDigestMethod(DigestMethod.SHA1, (DigestMethodParameterSpec) null);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public SignatureMethod createSignatureMethod(
+ SignatureContext signatureContext) {
+
+ XMLSignatureFactory signatureFactory = signatureContext.getSignatureFactory();
+
+ try {
+ return signatureFactory.newSignatureMethod(SignatureMethod.RSA_SHA1, (SignatureMethodParameterSpec) null);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ }
+
+ private static final String RESOURCE_PREFIX = "at/gv/egiz/bku/slcommands/impl/";
+
+ private static Unmarshaller unmarshaller;
+
+ private static PrivateKey privateKey;
+
+ private static X509Certificate certificate;
+
+ @BeforeClass
+ public static void setUpClass() throws JAXBException, NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException, UnrecoverableKeyException {
+
+ XSecProvider.addAsProvider(true);
+
+ String packageName = ObjectFactory.class.getPackage().getName();
+ packageName += ":"
+ + org.w3._2000._09.xmldsig_.ObjectFactory.class.getPackage().getName();
+ JAXBContext jaxbContext = JAXBContext.newInstance(packageName);
+
+ unmarshaller = jaxbContext.createUnmarshaller();
+
+ initURLDereferencer();
+
+ ClassLoader classLoader = SignatureTest.class.getClassLoader();
+ InputStream certStream = classLoader.getResourceAsStream(RESOURCE_PREFIX + "Cert.p12");
+ assertNotNull("Certificate not found.", certStream);
+
+ char[] passwd = "1622".toCharArray();
+
+ KeyStore keystore = KeyStore.getInstance("PKCS12");
+ keystore.load(certStream, passwd);
+ String firstAlias = keystore.aliases().nextElement();
+ certificate = (X509Certificate) keystore.getCertificate(firstAlias);
+ privateKey = (PrivateKey) keystore.getKey(firstAlias, passwd);
+
+ }
+
+ private static void initURLDereferencer() {
+
+ URLDereferencer.getInstance().registerHandler("testlocal", new URLProtocolHandler() {
+
+ @Override
+ public StreamData dereference(String url, URLDereferencerContext context)
+ throws IOException {
+
+ ClassLoader classLoader = SignatureTest.class.getClassLoader();
+
+ String filename = url.split(":", 2)[1];
+
+ InputStream stream = classLoader.getResourceAsStream(RESOURCE_PREFIX + filename);
+
+ if (stream == null) {
+
+ throw new IOException("Failed to resolve resource '" + url + "'.");
+
+ } else {
+
+ String contentType;
+ if (filename.endsWith(".xml")) {
+ contentType = "text/xml";
+ } else if (filename.endsWith(".txt")) {
+ contentType = "text/plain";
+ } else {
+ contentType = "";
+ }
+
+ return new StreamData(url, contentType, stream);
+
+ }
+
}
@Override
@@ -205,558 +206,600 @@ public class SignatureTest {
public void setSSLSocketFactory(SSLSocketFactory socketFactory) {
// TODO Auto-generated method stub
- }
-
- });
-
- }
-
- private Object unmarshal(String file) throws XMLStreamException, JAXBException {
-
- ClassLoader classLoader = SignatureTest.class.getClassLoader();
- InputStream resourceStream = classLoader.getResourceAsStream(RESOURCE_PREFIX + file);
- assertNotNull(resourceStream);
-
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- XMLEventReader eventReader = inputFactory.createXMLEventReader(resourceStream);
- RedirectEventFilter redirectEventFilter = new RedirectEventFilter();
- XMLEventReader filteredReader = inputFactory.createFilteredReader(eventReader, redirectEventFilter);
-
- unmarshaller.setListener(new RedirectUnmarshallerListener(redirectEventFilter));
-
- return unmarshaller.unmarshal(filteredReader);
-
- }
-
- //
- //
- // SignatureInfo
- //
- //
-
- @SuppressWarnings("unchecked")
- private SignatureInfoCreationType unmarshalSignatureInfo(String file) throws JAXBException, XMLStreamException {
-
- Object object = unmarshal(file);
-
- Object requestType = ((JAXBElement) object).getValue();
-
- assertTrue(requestType instanceof CreateXMLSignatureRequestType);
-
- SignatureInfoCreationType signatureInfo = ((CreateXMLSignatureRequestType) requestType).getSignatureInfo();
-
- assertNotNull(signatureInfo);
-
- return signatureInfo;
-
- }
-
- @Test
- public void testSetSignatureInfo_Base64_1() throws JAXBException, SLCommandException, XMLStreamException {
-
- SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Base64_1.xml");
-
- Signature signature = new Signature(null, new IdValueFactoryImpl(), null);
-
- signature.setSignatureInfo(signatureInfo);
-
- Node parent = signature.getParent();
- Node nextSibling = signature.getNextSibling();
-
- assertNotNull(parent);
- assertTrue("urn:document".equals(parent.getNamespaceURI()));
- assertTrue("XMLDocument".equals(parent.getLocalName()));
-
- assertNotNull(nextSibling);
- assertTrue("urn:document".equals(nextSibling.getNamespaceURI()));
- assertTrue("Paragraph".equals(nextSibling.getLocalName()));
-
- }
-
- @Test
- public void testSetSignature_Base64_2() throws JAXBException, SLCommandException, XMLStreamException {
-
- SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Base64_2.xml");
-
- Signature signature = new Signature(null, new IdValueFactoryImpl(), null);
-
- signature.setSignatureInfo(signatureInfo);
-
- Node parent = signature.getParent();
- Node nextSibling = signature.getNextSibling();
-
- assertNotNull(parent);
- assertTrue("XMLDocument".equals(parent.getLocalName()));
-
- assertNotNull(nextSibling);
- assertTrue("Paragraph".equals(nextSibling.getLocalName()));
-
- }
-
- @Test
- public void testSetSignature_Base64_3() throws JAXBException, SLCommandException, XMLStreamException {
-
- SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Base64_3.xml");
-
- Signature signature = new Signature(null, new IdValueFactoryImpl(), null);
-
- signature.setSignatureInfo(signatureInfo);
-
- Node parent = signature.getParent();
- Node nextSibling = signature.getNextSibling();
-
- assertNotNull(parent);
- assertTrue("XMLDocument".equals(parent.getLocalName()));
-
- assertNotNull(nextSibling);
- assertTrue("Paragraph".equals(nextSibling.getLocalName()));
-
- }
-
- @Test
- public void testSetSignatureInfo_XMLContent_1() throws JAXBException, SLCommandException, XMLStreamException {
-
- SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_XMLContent_1.xml");
-
- Signature signature = new Signature(null, new IdValueFactoryImpl(), null);
-
- signature.setSignatureInfo(signatureInfo);
-
- Node parent = signature.getParent();
- Node nextSibling = signature.getNextSibling();
-
- assertNotNull(parent);
- assertTrue("urn:document".equals(parent.getNamespaceURI()));
- assertTrue("Whole".equals(parent.getLocalName()));
-
- assertNull(nextSibling);
-
- }
-
- @Test
- public void testSetSignature_Reference_1() throws JAXBException, SLCommandException, XMLStreamException {
-
- SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Reference_1.xml");
-
- Signature signature = new Signature(null, new IdValueFactoryImpl(), null);
-
- signature.setSignatureInfo(signatureInfo);
-
- Node parent = signature.getParent();
- Node nextSibling = signature.getNextSibling();
-
- assertNotNull(parent);
- assertTrue("urn:document".equals(parent.getNamespaceURI()));
- assertTrue("Paragraph".equals(parent.getLocalName()));
-
- assertNull(nextSibling);
-
- }
-
- //
- //
- // DataObject
- //
- //
-
- @SuppressWarnings("unchecked")
- private List unmarshalDataObjectInfo(String file) throws JAXBException, XMLStreamException {
-
- Object object = unmarshal(file);
-
- Object requestType = ((JAXBElement) object).getValue();
-
- assertTrue(requestType instanceof CreateXMLSignatureRequestType);
-
- List dataObjectInfos = ((CreateXMLSignatureRequestType) requestType).getDataObjectInfo();
-
- assertNotNull(dataObjectInfos);
-
- return dataObjectInfos;
-
- }
-
- private void signAndMarshalSignature(Signature signature) throws MarshalException, XMLSignatureException, SLCommandException, SLViewerException {
-
- Node parent = signature.getParent();
- Node nextSibling = signature.getNextSibling();
-
- DOMSignContext signContext = (nextSibling == null)
- ? new DOMSignContext(privateKey, parent)
- : new DOMSignContext(privateKey, parent, nextSibling);
-
- signature.sign(signContext);
-
- Document document = signature.getDocument();
-
- DOMImplementationLS domImplLS = DOMUtils.getDOMImplementationLS();
- LSOutput output = domImplLS.createLSOutput();
- output.setByteStream(System.out);
-
- LSSerializer serializer = domImplLS.createLSSerializer();
-// serializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
- serializer.getDomConfig().setParameter("namespaces", Boolean.FALSE);
- serializer.write(document, output);
-
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testDataObject_Base64Content_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
-
- List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Base64Content_1.xml");
-
- Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
-
- for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
- signature.addDataObject(dataObjectInfo);
- }
-
- signature.setSignerCeritifcate(certificate);
-
- signature.buildXMLSignature();
-
- signAndMarshalSignature(signature);
-
- List references = signature.getReferences();
- assertTrue(references.size() == 2);
-
- Reference reference = references.get(0);
- assertNotNull(reference.getId());
-
- List transforms = reference.getTransforms();
- assertTrue(transforms.size() == 1);
-
- Transform transform = transforms.get(0);
- assertTrue(Transform.BASE64.equals(transform.getAlgorithm()));
-
- List objects = signature.getXMLObjects();
- assertNotNull(objects);
- assertTrue("Size " + objects.size() + " but should be 2.", objects.size() == 2);
-
- XMLObject object = objects.get(0);
-
- assertTrue(("#" + object.getId()).equals(reference.getURI()));
-
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testDataObject_XMLContent_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
-
- List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_XMLContent_1.xml");
-
- Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
-
- for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
- signature.addDataObject(dataObjectInfo);
- }
-
- signature.setSignerCeritifcate(certificate);
-
- signature.buildXMLSignature();
-
- signAndMarshalSignature(signature);
-
- List references = signature.getReferences();
- assertTrue(references.size() == 2);
-
- Reference reference = references.get(0);
- assertNotNull(reference.getId());
-
- List transforms = reference.getTransforms();
- assertTrue(transforms.size() == 2);
-
- Transform transform = transforms.get(0);
- assertTrue(Transform.XPATH2.equals(transform.getAlgorithm()));
-
- List objects = signature.getXMLObjects();
- assertNotNull(objects);
- assertTrue("Size " + objects.size() + " but should be 2.", objects.size() == 2);
-
- XMLObject object = objects.get(0);
-
- assertTrue(("#" + object.getId()).equals(reference.getURI()));
-
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testDataObject_XMLContent_2() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
-
- List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_XMLContent_2.xml");
-
- Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
-
- for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
- signature.addDataObject(dataObjectInfo);
- }
-
- signature.setSignerCeritifcate(certificate);
-
- signature.buildXMLSignature();
-
- signAndMarshalSignature(signature);
-
- List references = signature.getReferences();
- assertTrue(references.size() == 2);
-
- Reference reference = references.get(0);
- assertNotNull(reference.getId());
-
- List transforms = reference.getTransforms();
- assertTrue(transforms.size() == 2);
-
- Transform transform = transforms.get(0);
- assertTrue(Transform.XPATH2.equals(transform.getAlgorithm()));
-
- List objects = signature.getXMLObjects();
- assertNotNull(objects);
- assertTrue("Size " + objects.size() + " but should be 2.", objects.size() == 2);
-
- XMLObject object = objects.get(0);
-
- assertTrue(("#" + object.getId()).equals(reference.getURI()));
-
- }
-
-
- @SuppressWarnings("unchecked")
- @Test
- public void testDataObject_LocRefContent_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
-
- List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_LocRefContent_1.xml");
-
- Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
-
- for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
- signature.addDataObject(dataObjectInfo);
- }
-
- signature.buildXMLSignature();
-
- signAndMarshalSignature(signature);
-
- List references = signature.getReferences();
- assertTrue(references.size() == 2);
-
- Reference reference = references.get(0);
- assertNotNull(reference.getId());
-
- List transforms = reference.getTransforms();
- assertTrue(transforms.size() == 2);
-
- Transform transform = transforms.get(0);
- assertTrue(Transform.XPATH2.equals(transform.getAlgorithm()));
-
- List objects = signature.getXMLObjects();
- assertNotNull(objects);
- assertTrue("Size " + objects.size() + " but should be 2.", objects.size() == 2);
-
- XMLObject object = objects.get(0);
-
- assertTrue(("#" + object.getId()).equals(reference.getURI()));
-
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testDataObject_LocRefContent_2() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
-
- List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_LocRefContent_2.xml");
-
- Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
-
- for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
- signature.addDataObject(dataObjectInfo);
- }
-
- signature.buildXMLSignature();
-
- signAndMarshalSignature(signature);
-
- List references = signature.getReferences();
- assertTrue(references.size() == 2);
-
- Reference reference = references.get(0);
- assertNotNull(reference.getId());
-
- List transforms = reference.getTransforms();
- assertTrue(transforms.size() == 1);
-
- Transform transform = transforms.get(0);
- assertTrue(Transform.BASE64.equals(transform.getAlgorithm()));
-
- List objects = signature.getXMLObjects();
- assertNotNull(objects);
- assertTrue("Size " + objects.size() + " but should be 2.", objects.size() == 2);
-
- XMLObject object = objects.get(0);
-
- assertTrue(("#" + object.getId()).equals(reference.getURI()));
-
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testDataObject_Reference_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
-
- List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Reference_1.xml");
-
- Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
-
- for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
- signature.addDataObject(dataObjectInfo);
- }
-
- signature.buildXMLSignature();
-
- signAndMarshalSignature(signature);
-
- List references = signature.getReferences();
- assertTrue(references.size() == 2);
-
- Reference reference = references.get(0);
- assertNotNull(reference.getId());
-
- List transforms = reference.getTransforms();
- assertTrue(transforms.size() == 1);
-
- Transform transform = transforms.get(0);
- assertTrue(Transform.BASE64.equals(transform.getAlgorithm()));
-
- List objects = signature.getXMLObjects();
- assertNotNull(objects);
- assertTrue("Size " + objects.size() + " but should be 2.", objects.size() == 2);
-
- XMLObject object = objects.get(0);
-
- assertTrue(("#" + object.getId()).equals(reference.getURI()));
-
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testDataObject_Detached_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
-
- List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Detached_1.xml");
-
- Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
-
- for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
- signature.addDataObject(dataObjectInfo);
- }
-
- signature.buildXMLSignature();
-
- signAndMarshalSignature(signature);
-
- List references = signature.getReferences();
- assertTrue(references.size() == 2);
-
- Reference reference = references.get(0);
- assertNotNull(reference.getId());
-
- List transforms = reference.getTransforms();
- assertTrue(transforms.size() == 0);
-
- List objects = signature.getXMLObjects();
- assertNotNull(objects);
- assertTrue(objects.size() == 1);
-
- }
-
- @SuppressWarnings("unchecked")
- @Test
- public void testDataObject_Detached_Base64Content() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
-
- List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Detached_Base64Content.xml");
-
- Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
-
- for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
- signature.addDataObject(dataObjectInfo);
- }
-
- signature.buildXMLSignature();
-
- signAndMarshalSignature(signature);
-
- List references = signature.getReferences();
- assertTrue(references.size() == 2);
-
- Reference reference = references.get(0);
- assertNotNull(reference.getId());
-
- List transforms = reference.getTransforms();
- assertTrue(transforms.size() == 0);
-
- List objects = signature.getXMLObjects();
- assertNotNull(objects);
- assertTrue(objects.size() == 1);
-
- }
-
- //
- //
- // TransformsInfo
- //
- //
-
- @SuppressWarnings("unchecked")
- private CreateXMLSignatureRequestType unmarshalCreateXMLSignatureRequest(String file) throws JAXBException, XMLStreamException {
-
- Object object = unmarshal(file);
-
- Object requestType = ((JAXBElement) object).getValue();
-
- assertTrue(requestType instanceof CreateXMLSignatureRequestType);
-
- return (CreateXMLSignatureRequestType) requestType;
-
- }
-
-
- @SuppressWarnings("unchecked")
- @Test
- public void testTransformsInfo_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
-
- CreateXMLSignatureRequestType requestType = unmarshalCreateXMLSignatureRequest("TransformsInfo_1.xml");
-
- Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
-
-
- signature.setSignatureInfo(requestType.getSignatureInfo());
-
- List dataObjectInfos = requestType.getDataObjectInfo();
-
- for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
- signature.addDataObject(dataObjectInfo);
- }
-
- signature.setSignerCeritifcate(certificate);
-
- signature.buildXMLSignature();
-
- signAndMarshalSignature(signature);
-
- List references = signature.getReferences();
- assertTrue(references.size() == 2);
-
- Reference reference = references.get(0);
- assertNotNull(reference.getId());
-
- List transforms = reference.getTransforms();
- assertTrue("Size " + transforms.size() + "", transforms.size() == 3);
-
- Transform transform = transforms.get(0);
- assertTrue(Transform.ENVELOPED.equals(transform.getAlgorithm()));
-
- List objects = signature.getXMLObjects();
- assertNotNull(objects);
- assertTrue("Size " + objects.size() + " but should be 1.", objects.size() == 1);
-
- }
-
-
-}
+ }
+
+ });
+
+ }
+
+ private Object unmarshal(String file) throws XMLStreamException, JAXBException {
+
+ ClassLoader classLoader = SignatureTest.class.getClassLoader();
+ InputStream resourceStream = classLoader.getResourceAsStream(RESOURCE_PREFIX + file);
+ assertNotNull(resourceStream);
+
+ XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ XMLEventReader eventReader = inputFactory.createXMLEventReader(resourceStream);
+ RedirectEventFilter redirectEventFilter = new RedirectEventFilter();
+ XMLEventReader filteredReader = inputFactory.createFilteredReader(eventReader, redirectEventFilter);
+
+ unmarshaller.setListener(new RedirectUnmarshallerListener(redirectEventFilter));
+
+ return unmarshaller.unmarshal(filteredReader);
+
+ }
+
+ //
+ //
+ // SignatureInfo
+ //
+ //
+
+ @SuppressWarnings("unchecked")
+ private SignatureInfoCreationType unmarshalSignatureInfo(String file) throws JAXBException, XMLStreamException {
+
+ Object object = unmarshal(file);
+
+ Object requestType = ((JAXBElement) object).getValue();
+
+ assertTrue(requestType instanceof CreateXMLSignatureRequestType);
+
+ SignatureInfoCreationType signatureInfo = ((CreateXMLSignatureRequestType) requestType).getSignatureInfo();
+
+ assertNotNull(signatureInfo);
+
+ return signatureInfo;
+
+ }
+
+ @Test
+ public void testSetSignatureInfo_Base64_1() throws JAXBException, SLCommandException, XMLStreamException {
+
+ SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Base64_1.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), null);
+
+ signature.setSignatureInfo(signatureInfo);
+
+ Node parent = signature.getParent();
+ Node nextSibling = signature.getNextSibling();
+
+ assertNotNull(parent);
+ assertTrue("urn:document".equals(parent.getNamespaceURI()));
+ assertTrue("XMLDocument".equals(parent.getLocalName()));
+
+ assertNotNull(nextSibling);
+ assertTrue("urn:document".equals(nextSibling.getNamespaceURI()));
+ assertTrue("Paragraph".equals(nextSibling.getLocalName()));
+
+ }
+
+ @Test
+ public void testSetSignature_Base64_2() throws JAXBException, SLCommandException, XMLStreamException {
+
+ SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Base64_2.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), null);
+
+ signature.setSignatureInfo(signatureInfo);
+
+ Node parent = signature.getParent();
+ Node nextSibling = signature.getNextSibling();
+
+ assertNotNull(parent);
+ assertTrue("XMLDocument".equals(parent.getLocalName()));
+
+ assertNotNull(nextSibling);
+ assertTrue("Paragraph".equals(nextSibling.getLocalName()));
+
+ }
+
+ @Test
+ public void testSetSignature_Base64_3() throws JAXBException, SLCommandException, XMLStreamException {
+
+ SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Base64_3.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), null);
+
+ signature.setSignatureInfo(signatureInfo);
+
+ Node parent = signature.getParent();
+ Node nextSibling = signature.getNextSibling();
+
+ assertNotNull(parent);
+ assertTrue("XMLDocument".equals(parent.getLocalName()));
+
+ assertNotNull(nextSibling);
+ assertTrue("Paragraph".equals(nextSibling.getLocalName()));
+
+ }
+
+ @Test
+ public void testSetSignatureInfo_XMLContent_1() throws JAXBException, SLCommandException, XMLStreamException {
+
+ SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_XMLContent_1.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), null);
+
+ signature.setSignatureInfo(signatureInfo);
+
+ Node parent = signature.getParent();
+ Node nextSibling = signature.getNextSibling();
+
+ assertNotNull(parent);
+ assertTrue("urn:document".equals(parent.getNamespaceURI()));
+ assertTrue("Whole".equals(parent.getLocalName()));
+
+ assertNull(nextSibling);
+
+ }
+
+ @Test
+ public void testSetSignature_Reference_1() throws JAXBException, SLCommandException, XMLStreamException {
+
+ SignatureInfoCreationType signatureInfo = unmarshalSignatureInfo("SignatureInfo_Reference_1.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), null);
+
+ signature.setSignatureInfo(signatureInfo);
+
+ Node parent = signature.getParent();
+ Node nextSibling = signature.getNextSibling();
+
+ assertNotNull(parent);
+ assertTrue("urn:document".equals(parent.getNamespaceURI()));
+ assertTrue("Paragraph".equals(parent.getLocalName()));
+
+ assertNull(nextSibling);
+
+ }
+
+ //
+ //
+ // DataObject
+ //
+ //
+
+ @SuppressWarnings("unchecked")
+ private List unmarshalDataObjectInfo(String file) throws JAXBException, XMLStreamException {
+
+ Object object = unmarshal(file);
+
+ Object requestType = ((JAXBElement) object).getValue();
+
+ assertTrue(requestType instanceof CreateXMLSignatureRequestType);
+
+ List dataObjectInfos = ((CreateXMLSignatureRequestType) requestType).getDataObjectInfo();
+
+ assertNotNull(dataObjectInfos);
+
+ return dataObjectInfos;
+
+ }
+
+ private void signAndMarshalSignature(Signature signature) throws MarshalException, XMLSignatureException, SLCommandException, SLViewerException {
+
+ Node parent = signature.getParent();
+ Node nextSibling = signature.getNextSibling();
+
+ DOMSignContext signContext = (nextSibling == null)
+ ? new DOMSignContext(privateKey, parent)
+ : new DOMSignContext(privateKey, parent, nextSibling);
+
+ signature.sign(signContext);
+
+ Document document = signature.getDocument();
+
+ DOMImplementationLS domImplLS = DOMUtils.getDOMImplementationLS();
+ LSOutput output = domImplLS.createLSOutput();
+ output.setByteStream(System.out);
+
+ LSSerializer serializer = domImplLS.createLSSerializer();
+// serializer.getDomConfig().setParameter("format-pretty-print", Boolean.TRUE);
+ serializer.getDomConfig().setParameter("namespaces", Boolean.FALSE);
+ serializer.write(document, output);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testDataObject_Base64Content_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
+
+ List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Base64Content_1.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
+
+ for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
+ signature.addDataObject(dataObjectInfo);
+ }
+
+ signature.setSignerCeritifcate(certificate);
+
+ signature.buildXMLSignature();
+
+ signAndMarshalSignature(signature);
+
+ List references = signature.getReferences();
+ assertTrue(references.size() == 2);
+
+ Reference reference = references.get(0);
+ assertNotNull(reference.getId());
+
+ List transforms = reference.getTransforms();
+ assertTrue(transforms.size() == 1);
+
+ Transform transform = transforms.get(0);
+ assertTrue(Transform.BASE64.equals(transform.getAlgorithm()));
+
+ List objects = signature.getXMLObjects();
+ assertNotNull(objects);
+ assertTrue("Size " + objects.size() + " but should be 2.", objects.size() == 2);
+
+ XMLObject object = objects.get(0);
+
+ assertTrue(("#" + object.getId()).equals(reference.getURI()));
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testDataObject_XMLContent_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
+
+ List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_XMLContent_1.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
+
+ for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
+ signature.addDataObject(dataObjectInfo);
+ }
+
+ signature.setSignerCeritifcate(certificate);
+
+ signature.buildXMLSignature();
+
+ signAndMarshalSignature(signature);
+
+ List references = signature.getReferences();
+ assertTrue(references.size() == 2);
+
+ Reference reference = references.get(0);
+ assertNotNull(reference.getId());
+
+ List transforms = reference.getTransforms();
+ assertTrue(transforms.size() == 2);
+
+ Transform transform = transforms.get(0);
+ assertTrue(Transform.XPATH2.equals(transform.getAlgorithm()));
+
+ List objects = signature.getXMLObjects();
+ assertNotNull(objects);
+ assertTrue("Size " + objects.size() + " but should be 2.", objects.size() == 2);
+
+ XMLObject object = objects.get(0);
+
+ assertTrue(("#" + object.getId()).equals(reference.getURI()));
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testDataObject_XMLContent_2() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
+
+ List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_XMLContent_2.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
+
+ for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
+ signature.addDataObject(dataObjectInfo);
+ }
+
+ signature.setSignerCeritifcate(certificate);
+
+ signature.buildXMLSignature();
+
+ signAndMarshalSignature(signature);
+
+ List references = signature.getReferences();
+ assertTrue(references.size() == 2);
+
+ Reference reference = references.get(0);
+ assertNotNull(reference.getId());
+
+ List transforms = reference.getTransforms();
+ assertTrue(transforms.size() == 2);
+
+ Transform transform = transforms.get(0);
+ assertTrue(Transform.XPATH2.equals(transform.getAlgorithm()));
+
+ List objects = signature.getXMLObjects();
+ assertNotNull(objects);
+ assertTrue("Size " + objects.size() + " but should be 2.", objects.size() == 2);
+
+ XMLObject object = objects.get(0);
+
+ assertTrue(("#" + object.getId()).equals(reference.getURI()));
+
+ }
+
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testDataObject_LocRefContent_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
+
+ List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_LocRefContent_1.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
+
+ for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
+ signature.addDataObject(dataObjectInfo);
+ }
+
+ signature.buildXMLSignature();
+
+ signAndMarshalSignature(signature);
+
+ List references = signature.getReferences();
+ assertTrue(references.size() == 2);
+
+ Reference reference = references.get(0);
+ assertNotNull(reference.getId());
+
+ List transforms = reference.getTransforms();
+ assertTrue(transforms.size() == 2);
+
+ Transform transform = transforms.get(0);
+ assertTrue(Transform.XPATH2.equals(transform.getAlgorithm()));
+
+ List objects = signature.getXMLObjects();
+ assertNotNull(objects);
+ assertTrue("Size " + objects.size() + " but should be 2.", objects.size() == 2);
+
+ XMLObject object = objects.get(0);
+
+ assertTrue(("#" + object.getId()).equals(reference.getURI()));
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testDataObject_LocRefContent_2() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
+
+ List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_LocRefContent_2.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
+
+ for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
+ signature.addDataObject(dataObjectInfo);
+ }
+
+ signature.buildXMLSignature();
+
+ signAndMarshalSignature(signature);
+
+ List references = signature.getReferences();
+ assertTrue(references.size() == 2);
+
+ Reference reference = references.get(0);
+ assertNotNull(reference.getId());
+
+ List transforms = reference.getTransforms();
+ assertTrue(transforms.size() == 1);
+
+ Transform transform = transforms.get(0);
+ assertTrue(Transform.BASE64.equals(transform.getAlgorithm()));
+
+ List objects = signature.getXMLObjects();
+ assertNotNull(objects);
+ assertTrue("Size " + objects.size() + " but should be 2.", objects.size() == 2);
+
+ XMLObject object = objects.get(0);
+
+ assertTrue(("#" + object.getId()).equals(reference.getURI()));
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testDataObject_Reference_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
+
+ List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Reference_1.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
+
+ for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
+ signature.addDataObject(dataObjectInfo);
+ }
+
+ signature.buildXMLSignature();
+
+ signAndMarshalSignature(signature);
+
+ List references = signature.getReferences();
+ assertTrue(references.size() == 2);
+
+ Reference reference = references.get(0);
+ assertNotNull(reference.getId());
+
+ List transforms = reference.getTransforms();
+ assertTrue(transforms.size() == 1);
+
+ Transform transform = transforms.get(0);
+ assertTrue(Transform.BASE64.equals(transform.getAlgorithm()));
+
+ List objects = signature.getXMLObjects();
+ assertNotNull(objects);
+ assertTrue("Size " + objects.size() + " but should be 2.", objects.size() == 2);
+
+ XMLObject object = objects.get(0);
+
+ assertTrue(("#" + object.getId()).equals(reference.getURI()));
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testDataObject_Detached_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
+
+ List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Detached_1.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
+
+ for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
+ signature.addDataObject(dataObjectInfo);
+ }
+
+ signature.buildXMLSignature();
+
+ signAndMarshalSignature(signature);
+
+ List references = signature.getReferences();
+ assertTrue(references.size() == 2);
+
+ Reference reference = references.get(0);
+ assertNotNull(reference.getId());
+
+ List transforms = reference.getTransforms();
+ assertTrue(transforms.size() == 0);
+
+ List objects = signature.getXMLObjects();
+ assertNotNull(objects);
+ assertTrue(objects.size() == 1);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testDataObject_Detached_Base64Content() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
+
+ List dataObjectInfos = unmarshalDataObjectInfo("DataObjectInfo_Detached_Base64Content.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
+
+ for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
+ signature.addDataObject(dataObjectInfo);
+ }
+
+ signature.buildXMLSignature();
+
+ signAndMarshalSignature(signature);
+
+ List references = signature.getReferences();
+ assertTrue(references.size() == 2);
+
+ Reference reference = references.get(0);
+ assertNotNull(reference.getId());
+
+ List transforms = reference.getTransforms();
+ assertTrue(transforms.size() == 0);
+
+ List objects = signature.getXMLObjects();
+ assertNotNull(objects);
+ assertTrue(objects.size() == 1);
+
+ }
+
+ //
+ //
+ // TransformsInfo
+ //
+ //
+
+ @SuppressWarnings("unchecked")
+ private CreateXMLSignatureRequestType unmarshalCreateXMLSignatureRequest(String file) throws JAXBException, XMLStreamException {
+
+ Object object = unmarshal(file);
+
+ Object requestType = ((JAXBElement) object).getValue();
+
+ assertTrue(requestType instanceof CreateXMLSignatureRequestType);
+
+ return (CreateXMLSignatureRequestType) requestType;
+
+ }
+
+
+ @SuppressWarnings("unchecked")
+ @Test
+ public void testTransformsInfo_1() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
+
+ CreateXMLSignatureRequestType requestType = unmarshalCreateXMLSignatureRequest("TransformsInfo_1.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
+
+
+ signature.setSignatureInfo(requestType.getSignatureInfo());
+
+ List dataObjectInfos = requestType.getDataObjectInfo();
+
+ for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
+ signature.addDataObject(dataObjectInfo);
+ }
+
+ signature.setSignerCeritifcate(certificate);
+
+ signature.buildXMLSignature();
+
+ signAndMarshalSignature(signature);
+
+ List references = signature.getReferences();
+ assertTrue(references.size() == 2);
+
+ Reference reference = references.get(0);
+ assertNotNull(reference.getId());
+
+ List transforms = reference.getTransforms();
+ assertTrue("Size " + transforms.size() + "", transforms.size() == 3);
+
+ Transform transform = transforms.get(0);
+ assertTrue(Transform.ENVELOPED.equals(transform.getAlgorithm()));
+
+ List objects = signature.getXMLObjects();
+ assertNotNull(objects);
+ assertTrue("Size " + objects.size() + " but should be 1.", objects.size() == 1);
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Test
+ @Ignore
+ public void testTransformsInfo_2() throws JAXBException, SLCommandException, XMLStreamException, SLRequestException, MarshalException, XMLSignatureException, SLViewerException {
+
+ CreateXMLSignatureRequestType requestType = unmarshalCreateXMLSignatureRequest("TransformsInfo_2.xml");
+
+ Signature signature = new Signature(null, new IdValueFactoryImpl(), new AlgorithmMethodFactoryImpl());
+
+
+ signature.setSignatureInfo(requestType.getSignatureInfo());
+
+ List dataObjectInfos = requestType.getDataObjectInfo();
+
+ for (DataObjectInfoType dataObjectInfo : dataObjectInfos) {
+ signature.addDataObject(dataObjectInfo);
+ }
+
+ signature.setSignerCeritifcate(certificate);
+
+ signature.buildXMLSignature();
+
+ signAndMarshalSignature(signature);
+
+ List references = signature.getReferences();
+ assertTrue(references.size() == 2);
+
+ Reference reference = references.get(0);
+ assertNotNull(reference.getId());
+
+ List transforms = reference.getTransforms();
+ assertTrue("Size " + transforms.size() + "", transforms.size() == 2);
+
+ Transform transform = transforms.get(0);
+ assertTrue(Transform.XSLT.equals(transform.getAlgorithm()));
+
+ List objects = signature.getXMLObjects();
+ assertNotNull(objects);
+ assertTrue("Size " + objects.size() + " but should be 1.", objects.size() == 1);
+
+ }
+
+
+}
diff --git a/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/impl/TransformsInfo_2.xml b/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/impl/TransformsInfo_2.xml
new file mode 100644
index 00000000..f43dc61a
--- /dev/null
+++ b/bkucommon/src/test/resources/at/gv/egiz/bku/slcommands/impl/TransformsInfo_2.xml
@@ -0,0 +1,397 @@
+
+
+ SecureSignatureKeypair
+
+
+
+
+
+
+
+
+
+
+ Signatur der Anmeldedaten
+
+
+
+ Signatur der Anmeldedaten
+
+ Mit meiner elektronischen Signatur beantrage ich,
+
+ , geboren am . . , in der Rolle als (OID***= ), den Zugang zur gesicherten Anwendung.
+
+ Datum und Uhrzeit: . . , :
+ :
+
+
+ HPI(**):
+
+
+ wbPK(*):
+
+
+
+ Ich bin weiters ermächtigt als von
+ , geboren am . .
+
+ ,
+ , in deren Auftrag zu handeln.
+ wbPK(*) des Vollmachtgebers:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (*) wbPK: Das wirtschaftsbereichsspezifische
+ Personenkennzeichen wird aus den jeweiligen
+ Stammzahlen des Bürgers und des Wirtschaftsunternehmens
+ berechnet und ermöglicht eine eindeutige Zuordnung des
+ Bürgers zum Wirtschaftsunternehmen.
+
+
+ (**) HPI: Der eHealth Professional
+ Identifier wird aus den jeweiligen Stammzahlen
+ der Gesundheitsdiensteanbieterinnen /
+ Gesundheitsdiensteanbieter berechnet und ermöglicht eine
+ eindeutige Zuordnung der Gesundheitsdiensteanbieterin /
+ des Gesundheitsdiensteanbieters im
+ Gesundheitsbereich.
+
+
+ (***) OID: Object Identifier sind
+ standardisierte Objekt-Bezeichner und beschreiben
+ eindeutig die Rollen des GDA-Token Inhabers.
+
+
+
+
+
+
+
+
+
+ application/xhtml+xml
+
+
+
+
+
+
+
+
+
+
+
+ Signatur der Anmeldedaten
+
+
+ Signatur der Anmeldedaten
+
+ Mit meiner elektronischen Signatur beantrage ich,
+
+ , geboren am . . , in der Rolle als (OID***= ), den Zugang zur gesicherten Anwendung.
+
+ Datum und Uhrzeit: . . , :
+ :
+
+
+ HPI(**):
+
+
+ wbPK(*):
+
+
+
+ Ich bin weiters ermächtigt als von
+ , geboren am . .
+
+ ,
+ , in deren Auftrag zu handeln.
+ wbPK(*) des Vollmachtgebers:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (*) wbPK: Das wirtschaftsbereichsspezifische
+ Personenkennzeichen wird aus den jeweiligen
+ Stammzahlen des Bürgers und des Wirtschaftsunternehmens
+ berechnet und ermöglicht eine eindeutige Zuordnung des
+ Bürgers zum Wirtschaftsunternehmen.
+
+
+ (**) HPI: Der eHealth Professional Identifier
+ wird aus den jeweiligen Stammzahlen der
+ Gesundheitsdiensteanbieterinnen /
+ Gesundheitsdiensteanbieter berechnet und ermöglicht eine
+ eindeutige Zuordnung der Gesundheitsdiensteanbieterin /
+ des Gesundheitsdiensteanbieters im
+ Gesundheitsbereich.
+
+
+ (***) OID: Object Identifier sind standardisierte
+ Objekt-Bezeichner und beschreiben eindeutig die Rollen
+ des GDA-Token Inhabers.
+
+
+
+
+
+
+
+
+
+ text/html
+
+
+
+
+
+
+
+
+
+ Mit meiner elektronischen Signatur beantrage ich,
+
+ , geboren am
+
+ .
+
+ .
+
+ ,
+
+ in der Rolle als
+
+ (OID***=
+ )
+ ,
+
+ den Zugang zur gesicherten Anwendung.
+
Datum und Uhrzeit:
+
+ .
+
+ .
+
+ ,
+
+ :
+
+ :
+
+
+
+
HPI(**):
+
+
+
+
+
wbPK(*):
+
+
+
+
+
Ich bin weiters ermächtigt als
+
+ von
+
+
+ , geboren am
+
+ .
+
+ .
+
+
+
+ ,
+
+
+ , in deren Auftrag zu handeln.
+
+
+
wbPK(*) des Vollmachtgebers:
+
+
+
+
+
+
(*) wbPK: Das wirtschaftsbereichsspezifische Personenkennzeichen wird aus den jeweiligen Stammzahlen des Bürgers und des Wirtschaftsunternehmens berechnet und ermöglicht eine eindeutige Zuordnung des Bürgers zum Wirtschaftsunternehmen.
+
+
+
(**) HPI: Der eHealth Professional Identifier wird aus den jeweiligen Stammzahlen der Gesundheitsdiensteanbieterinnen / Gesundheitsdiensteanbieter berechnet und ermöglicht eine eindeutige Zuordnung der Gesundheitsdiensteanbieterin / des Gesundheitsdiensteanbieters im Gesundheitsbereich.
+
+
+
(***) OID: Object Identifier sind standardisierte Objekt-Bezeichner und beschreiben eindeutig die Rollen des GDA-Token Inhabers.
+
+
+
+
+
+
+ not(text())
+
+
+
+ text/plain
+
+
+
+
+
+
+
+
+
+ https://demo.egiz.gv.at/exchange-moa-id-auth/
+
+
+
+
+ LTpz8VYzns2jrx0J8Gm/R/nAhxA=
+ urn:publicid:gv.at:wbpk+FN+TODO
+
+
+
+
+ https://apps.egiz.gv.at/urlaubsschein-frontend/moaid-login
+
+
+ 1971-11-10
+
+
+
+
+
+ /saml:Assertion
+
+
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java b/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java
index 13c57686..86223854 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java
@@ -30,8 +30,6 @@ package at.gv.egiz.smcc;
import java.nio.charset.Charset;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import javax.smartcardio.CardChannel;
import javax.smartcardio.CardException;
import javax.smartcardio.CommandAPDU;
@@ -41,7 +39,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class ACOSCard extends AbstractSignatureCard implements SignatureCard {
-
+
private static Log log = LogFactory.getLog(ACOSCard.class);
public static final byte[] AID_DEC = new byte[] { (byte) 0xA0, (byte) 0x00,
@@ -100,8 +98,15 @@ public class ACOSCard extends AbstractSignatureCard implements SignatureCard {
(byte) 0x01 // RSA // TODO: Not verified yet
};
+ private static final int PINSPEC_INF = 0;
+ private static final int PINSPEC_DEC = 1;
+ private static final int PINSPEC_SIG = 2;
+
public ACOSCard() {
super("at/gv/egiz/smcc/ACOSCard");
+ pinSpecs.add(PINSPEC_INF, new PINSpec(4, 4, "[0-9]", getResourceBundle().getString("inf.pin.name"), KID_PIN_INF, null));
+ pinSpecs.add(PINSPEC_DEC, new PINSpec(4, 4, "[0-9]", getResourceBundle().getString("dec.pin.name"), KID_PIN_DEC, null));
+ pinSpecs.add(PINSPEC_SIG, new PINSpec(6, 10, "[0-9]", getResourceBundle().getString("sig.pin.name"), KID_PIN_SIG, null));
}
/* (non-Javadoc)
@@ -165,7 +170,8 @@ public class ACOSCard extends AbstractSignatureCard implements SignatureCard {
try {
if ("IdentityLink".equals(infobox)) {
- PINSpec spec = new PINSpec(4, 4, "[0-9]", getResourceBundle().getString("inf.pin.name"));
+ PINSpec spec = pinSpecs.get(PINSPEC_INF);
+ //new PINSpec(4, 4, "[0-9]", getResourceBundle().getString("inf.pin.name"));
int retries = -1;
String pin = null;
@@ -219,7 +225,8 @@ public class ACOSCard extends AbstractSignatureCard implements SignatureCard {
if (KeyboxName.SECURE_SIGNATURE_KEYPAIR.equals(keyboxName)) {
- PINSpec spec = new PINSpec(6, 10, "[0-9]", getResourceBundle().getString("sig.pin.name"));
+ PINSpec spec = pinSpecs.get(PINSPEC_SIG);
+ //new PINSpec(6, 10, "[0-9]", getResourceBundle().getString("sig.pin.name"));
int retries = -1;
String pin = null;
@@ -260,7 +267,8 @@ public class ACOSCard extends AbstractSignatureCard implements SignatureCard {
} else if (KeyboxName.CERITIFIED_KEYPAIR.equals(keyboxName)) {
- PINSpec spec = new PINSpec(4, 4, "[0-9]", getResourceBundle().getString("dec.pin.name"));
+ PINSpec spec = pinSpecs.get(PINSPEC_DEC);
+ //new PINSpec(4, 4, "[0-9]", getResourceBundle().getString("dec.pin.name"));
int retries = -1;
String pin = null;
@@ -321,11 +329,6 @@ public class ACOSCard extends AbstractSignatureCard implements SignatureCard {
0x00, fid, 256));
}
- @Override
- public byte[] getKIDs() {
- return new byte[] { KID_PIN_DEC, KID_PIN_INF, KID_PIN_SIG };
- }
-
@Override
public int verifyPIN(String pin, byte kid) throws LockedException, NotActivatedException, SignatureCardException {
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java b/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java
index 67f090a5..cb068725 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java
@@ -31,7 +31,11 @@ package at.gv.egiz.smcc;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
import java.util.Locale;
+import java.util.Map;
import java.util.ResourceBundle;
import javax.smartcardio.ATR;
@@ -49,6 +53,8 @@ public abstract class AbstractSignatureCard implements SignatureCard {
private static Log log = LogFactory.getLog(AbstractSignatureCard.class);
+ protected List pinSpecs = new ArrayList();
+
private ResourceBundle i18n;
private String resourceBundleName;
@@ -433,4 +439,8 @@ public abstract class AbstractSignatureCard implements SignatureCard {
}
}
+ @Override
+ public List getPINSpecs() {
+ return pinSpecs;
+ }
}
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java b/smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java
index 0852d664..d180ddf0 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/PINSpec.java
@@ -35,23 +35,40 @@ public class PINSpec {
String name_;
+ byte kid_;
+
+ byte[] context_aid_;
+
+ /**
+ *
+ * @param minLenght
+ * @param maxLength
+ * @param rexepPattern
+ * @param resourceBundle
+ * @param name
+ * @param kid the keyId for this pin
+ */
public PINSpec(int minLenght, int maxLength, String rexepPattern,
- ResourceBundle resourceBundle, String name) {
+ ResourceBundle resourceBundle, String name, byte kid, byte[] contextAID) {
minLength_ = minLenght;
maxLength_ = maxLength;
rexepPattern_ = rexepPattern;
resourceBundle_ = resourceBundle;
name_ = name;
+ kid_ = kid;
+ context_aid_ = contextAID;
}
public PINSpec(int minLenght, int maxLength, String rexepPattern,
- String name) {
+ String name, byte kid, byte[] contextAID) {
minLength_ = minLenght;
maxLength_ = maxLength;
rexepPattern_ = rexepPattern;
name_ = name;
+ kid_ = kid;
+ context_aid_ = contextAID;
}
@@ -75,7 +92,14 @@ public class PINSpec {
public String getRexepPattern() {
return rexepPattern_;
}
-
+
+ public byte getKID() {
+ return kid_;
+ }
+
+ public byte[] getContextAID() {
+ return context_aid_;
+ }
}
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
index e80c6683..ae43629e 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/STARCOSCard.java
@@ -29,10 +29,8 @@
package at.gv.egiz.smcc;
import java.math.BigInteger;
-import java.util.ArrayList;
import java.util.Arrays;
-import java.util.List;
import javax.smartcardio.CardChannel;
import javax.smartcardio.CardException;
import javax.smartcardio.CommandAPDU;
@@ -42,7 +40,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class STARCOSCard extends AbstractSignatureCard implements SignatureCard {
-
+
/**
* Logging facility.
*/
@@ -155,12 +153,17 @@ public class STARCOSCard extends AbstractSignatureCard implements SignatureCard
};
public static final byte KID_PIN_CARD = (byte) 0x01;
-
+
+ private static final int PINSPEC_CARD = 0;
+ private static final int PINSPEC_SS = 1;
+
/**
* Creates an new instance.
*/
public STARCOSCard() {
super("at/gv/egiz/smcc/STARCOSCard");
+ pinSpecs.add(PINSPEC_CARD, new PINSpec(4, 4, "[0-9]", getResourceBundle().getString("card.pin.name"), KID_PIN_CARD, null));
+ pinSpecs.add(PINSPEC_SS, new PINSpec(6, 10, "[0-9]", getResourceBundle().getString("sig.pin.name"), KID_PIN_SS, AID_DF_SS));
}
@Override
@@ -210,7 +213,8 @@ public class STARCOSCard extends AbstractSignatureCard implements SignatureCard
try {
if ("IdentityLink".equals(infobox)) {
- PINSpec spec = new PINSpec(4, 4, "[0-9]", getResourceBundle().getString("card.pin.name"));
+ PINSpec spec = pinSpecs.get(PINSPEC_CARD);
+ //new PINSpec(4, 4, "[0-9]", getResourceBundle().getString("card.pin.name"));
int retries = -1;
String pin = null;
@@ -302,7 +306,8 @@ public class STARCOSCard extends AbstractSignatureCard implements SignatureCard
if (KeyboxName.SECURE_SIGNATURE_KEYPAIR.equals(keyboxName)) {
- PINSpec spec = new PINSpec(6, 10, "[0-9]", getResourceBundle().getString("sig.pin.name"));
+ PINSpec spec = pinSpecs.get(PINSPEC_SS);
+ //new PINSpec(6, 10, "[0-9]", getResourceBundle().getString("sig.pin.name"));
int retries = -1;
String pin = null;
@@ -334,7 +339,8 @@ public class STARCOSCard extends AbstractSignatureCard implements SignatureCard
} else if (KeyboxName.CERITIFIED_KEYPAIR.equals(keyboxName)) {
- PINSpec spec = new PINSpec(4, 4, "[0-9]", getResourceBundle().getString("card.pin.name"));
+ PINSpec spec = pinSpecs.get(PINSPEC_CARD);
+ //new PINSpec(4, 4, "[0-9]", getResourceBundle().getString("card.pin.name"));
int retries = -1;
String pin = null;
@@ -455,11 +461,6 @@ public class STARCOSCard extends AbstractSignatureCard implements SignatureCard
}
}
- @Override
- public byte[] getKIDs() {
- return new byte[] { KID_PIN_CARD, KID_PIN_SS };
- }
-
/**
* VERIFY PIN
*
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java b/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java
index bad7ccf6..8dc4ac2a 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java
@@ -36,9 +36,13 @@ import java.security.cert.Certificate;
import java.security.cert.CertificateEncodingException;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
+import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.List;
import java.util.Locale;
+import java.util.Map;
import javax.smartcardio.Card;
import javax.smartcardio.CardTerminal;
@@ -311,7 +315,7 @@ public class SWCard implements SignatureCard {
if (password == null) {
- PINSpec pinSpec = new PINSpec(0, -1, ".", "KeyStore-Password");
+ PINSpec pinSpec = new PINSpec(0, -1, ".", "KeyStore-Password", (byte) 0x01, null);
password = provider.providePIN(pinSpec, -1);
@@ -390,13 +394,13 @@ public class SWCard implements SignatureCard {
}
@Override
- public byte[] getKIDs() {
- return null;
+ public int verifyPIN(String pin, byte kid) throws LockedException, NotActivatedException, SignatureCardException {
+ return -1;
}
@Override
- public int verifyPIN(String pin, byte kid) throws LockedException, NotActivatedException, SignatureCardException {
- return -1;
+ public List getPINSpecs() {
+ return new ArrayList();
}
}
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/SignatureCard.java b/smcc/src/main/java/at/gv/egiz/smcc/SignatureCard.java
index 1ec35b78..1e5e09c8 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/SignatureCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/SignatureCard.java
@@ -31,6 +31,7 @@ package at.gv.egiz.smcc;
import java.util.List;
import java.util.Locale;
+import java.util.Map;
import javax.smartcardio.Card;
import javax.smartcardio.CardTerminal;
@@ -118,10 +119,10 @@ public interface SignatureCard {
PINProvider provider) throws SignatureCardException, InterruptedException;
/**
- * get the KIDs for the availabel PINs
+ * Get the KIDs for all available PINs and the corresponding PINSpecs
* @return array of KIDs
*/
- public byte[] getKIDs();
+ public List getPINSpecs();
/**
*
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java
index e10ba8f9..b6c5a8ca 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractBKUWorker.java
@@ -102,6 +102,9 @@ public abstract class AbstractBKUWorker extends AbstractSMCCSTAL implements Acti
@Override
protected boolean waitForCard() {
+ if (signatureCard != null) {
+ return false;
+ }
SMCCHelper smccHelper = new SMCCHelper();
actionCommandList.clear();
actionCommandList.add("cancel");
diff --git a/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java b/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java
index a5f8a771..a5d6df23 100644
--- a/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java
+++ b/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java
@@ -86,15 +86,16 @@ public class AbstractSMCCSTALTest extends AbstractSMCCSTAL implements
}
- @Override
- public byte[] getKIDs() {
- return null;
- }
@Override
public int verifyPIN(String pin, byte kid) throws LockedException, NotActivatedException, SignatureCardException {
return 0;
}
+
+ @Override
+ public List getPINSpecs() {
+ return new ArrayList();
+ }
};
return false;
diff --git a/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefix.java b/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefix.java
new file mode 100644
index 00000000..c03f17cd
--- /dev/null
+++ b/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefix.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.marshal;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public interface NamespacePrefix {
+ String CARDCHANNEL_PREFIX = "cc";
+ String ECDSA_PREFIX = "ecdsa";
+ String PERSONDATA_PREFIX = "pr";
+ String SAML10_PREFIX = "saml";
+ String SL_PREFIX = "sl";
+ String XADES_PREFIX = "xades";
+ String XMLDSIG_PREFIX = "xmldsig";
+ String XSI_PREFIX = "xsi";
+
+}
diff --git a/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java b/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java
index a08c1188..519f6b1f 100644
--- a/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java
+++ b/utils/src/main/java/at/gv/egiz/marshal/NamespacePrefixMapperImpl.java
@@ -36,35 +36,35 @@ public class NamespacePrefixMapperImpl extends NamespacePrefixMapper {
log.trace("prefix for namespace " + namespaceUri + " requested");
}
if ("http://www.w3.org/2001/XMLSchema-instance".equals(namespaceUri)) {
- return "xsi";
+ return NamespacePrefix.XSI_PREFIX;
}
if ("http://www.w3.org/2000/09/xmldsig#".equals(namespaceUri)) {
- return "dsig";
+ return NamespacePrefix.XMLDSIG_PREFIX;
}
if ("http://www.buergerkarte.at/namespaces/securitylayer/1.2#".equals(namespaceUri)) {
- return "sl";
+ return NamespacePrefix.SL_PREFIX;
}
if ("http://www.buergerkarte.at/cardchannel".equals(namespaceUri)) {
- return "cc";
+ return NamespacePrefix.CARDCHANNEL_PREFIX;
}
if ("http://www.w3.org/2001/04/xmldsig-more#".equals(namespaceUri)) {
- return "ecdsa";
+ return NamespacePrefix.ECDSA_PREFIX;
}
if ("http://reference.e-government.gv.at/namespace/persondata/20020228#".equals(namespaceUri)) {
- return "pr";
+ return NamespacePrefix.PERSONDATA_PREFIX;
}
if ("urn:oasis:names:tc:SAML:1.0:assertion".equals(namespaceUri)) {
- return "saml";
+ return NamespacePrefix.SAML10_PREFIX;
}
if ("http://uri.etsi.org/01903/v1.1.1#".equals(namespaceUri)) {
- return "xades";
+ return NamespacePrefix.XADES_PREFIX;
}
return suggestion;
diff --git a/utils/src/main/java/at/gv/egiz/slbinding/RedirectEventFilter.java b/utils/src/main/java/at/gv/egiz/slbinding/RedirectEventFilter.java
index d2a7fb30..14c5ba48 100644
--- a/utils/src/main/java/at/gv/egiz/slbinding/RedirectEventFilter.java
+++ b/utils/src/main/java/at/gv/egiz/slbinding/RedirectEventFilter.java
@@ -1,19 +1,19 @@
/*
-* 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.
-*/
+ * 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.
@@ -33,79 +33,84 @@ import javax.xml.stream.events.XMLEvent;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+/*
+ * TODO: don't set redirect stream from caller (caller does not know whether redirection will be triggered)
+ * rather create on trigger and pass to caller
+ */
public class RedirectEventFilter implements EventFilter {
- public static final String DEFAULT_ENCODING = "UTF-8";
- private static Log log = LogFactory.getLog(RedirectEventFilter.class);
- protected XMLEventWriter redirectWriter = null;
- protected Set redirectTriggers = null;
- private int depth = -1;
- protected NamespaceContext currentNamespaceContext = null;
+ public static final String DEFAULT_ENCODING = "UTF-8";
+ private static Log log = LogFactory.getLog(RedirectEventFilter.class);
+ protected XMLEventWriter redirectWriter = null;
+ protected Set redirectTriggers = null;
+ private int depth = -1;
+ protected NamespaceContext currentNamespaceContext = null;
- /**
- * Event redirection is disabled, set a redirect stream to enable.
- */
- public RedirectEventFilter() {
- redirectWriter = null;
- // redirectTriggers = null;
- }
+ /**
+ * Event redirection is disabled, set a redirect stream to enable.
+ */
+ public RedirectEventFilter() {
+ redirectWriter = null;
+ // redirectTriggers = null;
+ }
- /**
- *
- * @param redirectStream
- * if null, no events are redirected
- * @param redirectTriggers
- * if null, all events are redirected
- */
- public RedirectEventFilter(OutputStream redirectStream, String encoding)
- throws XMLStreamException { // , List redirectTriggers
- if (redirectStream != null) {
- XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
- if (encoding == null) {
- encoding = DEFAULT_ENCODING;
- }
- this.redirectWriter = outputFactory.createXMLEventWriter(redirectStream,
+ /**
+ *
+ * @param redirectStream
+ * if null, no events are redirected
+ * @param redirectTriggers
+ * if null, all events are redirected
+ */
+ public RedirectEventFilter(OutputStream redirectStream, String encoding)
+ throws XMLStreamException { // , List redirectTriggers
+ if (redirectStream != null) {
+ XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ if (encoding == null) {
+ encoding = DEFAULT_ENCODING;
+ }
+ this.redirectWriter = outputFactory.createXMLEventWriter(redirectStream,
encoding);
- }
- // this.redirectTriggers = redirectTriggers;
}
+ // this.redirectTriggers = redirectTriggers;
+ }
- /**
- * All startElement events occuring in the redirectTriggers list will trigger
- * redirection of the entire (sub-)fragment.
- *
- * @param event
- * @return false if an event is redirected
- */
- @Override
- public boolean accept(XMLEvent event) {
- int eventType = event.getEventType();
+ /**
+ * All startElement events occuring in the redirectTriggers list will trigger
+ * redirection of the entire (sub-)fragment.
+ *
+ * @param event
+ * @return false if an event is redirected
+ */
+ @Override
+ public boolean accept(XMLEvent event) {
+ int eventType = event.getEventType();
- if (eventType == XMLStreamConstants.START_ELEMENT) {
- currentNamespaceContext = event.asStartElement().getNamespaceContext();
- }
- if (redirectWriter == null) {
- return true;
- }
- if (eventType == XMLStreamConstants.START_ELEMENT) {
- if (depth >= 0 || triggersRedirect(event.asStartElement().getName())) {
- depth++;
- }
- } else if (eventType == XMLStreamConstants.END_ELEMENT) {
- if (depth >= 0 && --depth < 0) {
- // redirect the end element of the trigger,
- // but do not redirect the end element of the calling type
- if (redirectTriggers != null) {
- redirectEvent(event);
- return false;
- }
- }
- }
- if (depth >= 0) { //|| (depth == 0 && redirectTriggers == null)) {
- redirectEvent(event);
- return false;
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ //hopefully, this is a copy
+ currentNamespaceContext = event.asStartElement().getNamespaceContext();
+ }
+ if (redirectWriter == null) {
+ return true;
+ }
+ if (eventType == XMLStreamConstants.START_ELEMENT) {
+ if (depth >= 0 || triggersRedirect(event.asStartElement().getName())) {
+ depth++;
+ }
+ } else if (eventType == XMLStreamConstants.END_ELEMENT) {
+ if (depth >= 0 && --depth < 0) {
+ // redirect the end element of the trigger,
+ // but do not redirect the end element of the calling type
+ if (redirectTriggers != null) {
+ redirectEvent(event);
+ return false;
}
- return true; // depth < 0;
+ }
+ }
+ if (depth >= 0) { //|| (depth == 0 && redirectTriggers == null)) {
+ redirectEvent(event);
+ return false;
+ }
+ return true; // depth < 0;
// switch (event.getEventType()) {
// case XMLStreamConstants.START_ELEMENT:
@@ -132,128 +137,130 @@ public class RedirectEventFilter implements EventFilter {
// return false;
// }
// return true; // depth < 0;
- }
+ }
- /**
- * @param startElt
- * @return true if the set of triggers contains startElement
- * (or no triggers are registered, i.e. everything is redirected)
- */
- private boolean triggersRedirect(QName startElement) {
- if (redirectTriggers != null) {
- return redirectTriggers.contains(startElement);
- }
- return true;
+ /**
+ * @param startElt
+ * @return true if the set of triggers contains startElement
+ * (or no triggers are registered, i.e. everything is redirected)
+ */
+ private boolean triggersRedirect(QName startElement) {
+ if (redirectTriggers != null) {
+ return redirectTriggers.contains(startElement);
}
+ return true;
+ }
- private void redirectEvent(XMLEvent event) {
- try {
- if (log.isTraceEnabled()) {
- log.trace("redirecting StAX event " + event);
- }
- redirectWriter.add(event);
- } catch (XMLStreamException ex) {
- ex.printStackTrace();
- }
+ private void redirectEvent(XMLEvent event) {
+ try {
+ if (log.isTraceEnabled()) {
+ log.trace("redirecting StAX event " + event);
+ }
+ redirectWriter.add(event);
+ } catch (XMLStreamException ex) {
+ ex.printStackTrace();
}
+ }
- /**
- * Enable/disable redirection of all events from now on.
- * The redirected events will be UTF-8 encoded and written to the stream.
- *
- * @param redirectstream
- * if null, redirection is disabled
- */
- public void setRedirectStream(OutputStream redirectStream) throws XMLStreamException {
- setRedirectStream(redirectStream, DEFAULT_ENCODING, null);
- }
+ /**
+ * Enable/disable redirection of all events from now on.
+ * The redirected events will be UTF-8 encoded and written to the stream.
+ *
+ * @param redirectstream
+ * if null, redirection is disabled
+ */
+ public void setRedirectStream(OutputStream redirectStream) throws XMLStreamException {
+ setRedirectStream(redirectStream, DEFAULT_ENCODING, null);
+ }
- /**
- * Enable/disable redirection of all events from now on.
- *
- * @param redirectStream if null, redirection is disabled
- * @param encoding The encoding for the redirect stream
- * @throws javax.xml.stream.XMLStreamException
- */
- public void setRedirectStream(OutputStream redirectStream, String encoding) throws XMLStreamException {
- setRedirectStream(redirectStream, encoding, null);
- }
+ /**
+ * Enable/disable redirection of all events from now on.
+ *
+ * @param redirectStream if null, redirection is disabled
+ * @param encoding The encoding for the redirect stream
+ * @throws javax.xml.stream.XMLStreamException
+ */
+ public void setRedirectStream(OutputStream redirectStream, String encoding) throws XMLStreamException {
+ setRedirectStream(redirectStream, encoding, null);
+ }
- /**
- * Enable/disable redirection of all (child) elements contained in redirect triggers.
- * The redirected events will be UTF-8 encoded and written to the stream.
- *
- * @param redirectstream
- * if null, redirection is disabled
- * @param redirectTriggers elements that trigger the redirection
- */
- public void setRedirectStream(OutputStream redirectStream, Set redirectTriggers) throws XMLStreamException {
- setRedirectStream(redirectStream, DEFAULT_ENCODING, redirectTriggers);
- }
+ /**
+ * Enable/disable redirection of all (child) elements contained in redirect triggers.
+ * The redirected events will be UTF-8 encoded and written to the stream.
+ *
+ * @param redirectstream
+ * if null, redirection is disabled
+ * @param redirectTriggers elements that trigger the redirection
+ */
+ public void setRedirectStream(OutputStream redirectStream, Set redirectTriggers) throws XMLStreamException {
+ setRedirectStream(redirectStream, DEFAULT_ENCODING, redirectTriggers);
+ }
- /**
- * Enable/disable redirection of all (child) elements contained in redirect triggers.
- *
- * @param redirectstream
- * if null, redirection is disabled
- * @param encoding The encoding for the redirect stream
- * @param redirectTriggers elements that trigger the redirection
- */
- public void setRedirectStream(OutputStream redirectStream, String encoding, Set redirectTriggers) throws XMLStreamException {
- if (redirectStream != null) {
- XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
- if (encoding == null) {
- encoding = DEFAULT_ENCODING;
- }
- redirectWriter = outputFactory.createXMLEventWriter(redirectStream,
+ /**
+ * Enable/disable redirection of all (child) elements contained in redirect triggers.
+ *
+ * TODO: don't set redirect stream from caller (caller does not know whether redirection will be triggered)
+ * rather create on trigger and pass to caller
+ * @param redirectstream
+ * if null, redirection is disabled
+ * @param encoding The encoding for the redirect stream
+ * @param redirectTriggers elements that trigger the redirection
+ */
+ public void setRedirectStream(OutputStream redirectStream, String encoding, Set redirectTriggers) throws XMLStreamException {
+ if (redirectStream != null) {
+ XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ if (encoding == null) {
+ encoding = DEFAULT_ENCODING;
+ }
+ redirectWriter = outputFactory.createXMLEventWriter(redirectStream,
encoding);
- if (redirectTriggers == null) {
- // start redirecting
- depth = 0;
- }
- this.redirectTriggers = redirectTriggers;
- } else {
- redirectWriter = null;
- this.redirectTriggers = null;
- }
+ if (redirectTriggers == null) {
+ // start redirecting
+ depth = 0;
+ }
+ this.redirectTriggers = redirectTriggers;
+ } else {
+ redirectWriter = null;
+ this.redirectTriggers = null;
}
+ }
- /**
- * Enable/disable redirection of fragments (defined by elements in
- * redirectTriggers)
- *
- * @param redirectStream
- * if null, redirection is disabled
- * @param redirectTriggers
- * All startElement events occuring in this list will trigger
- * redirection of the entire fragment. If null, all events are
- * redirected
- */
- // public void setRedirectStream(OutputStream redirectStream, List
- // redirectTriggers) throws XMLStreamException {
- // if (redirectStream != null) {
- // XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
- // redirectWriter = outputFactory.createXMLEventWriter(redirectStream);
- // } else {
- // redirectWriter = null;
- // }
- // this.redirectTriggers = (redirectStream == null) ? null : redirectTriggers;
- // }
- /**
- * flushes the internal EventWriter
- *
- * @throws javax.xml.stream.XMLStreamException
- */
- public void flushRedirectStream() throws XMLStreamException {
- redirectWriter.flush();
- }
+ /**
+ * Enable/disable redirection of fragments (defined by elements in
+ * redirectTriggers)
+ *
+ * @param redirectStream
+ * if null, redirection is disabled
+ * @param redirectTriggers
+ * All startElement events occuring in this list will trigger
+ * redirection of the entire fragment. If null, all events are
+ * redirected
+ */
+ // public void setRedirectStream(OutputStream redirectStream, List
+ // redirectTriggers) throws XMLStreamException {
+ // if (redirectStream != null) {
+ // XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+ // redirectWriter = outputFactory.createXMLEventWriter(redirectStream);
+ // } else {
+ // redirectWriter = null;
+ // }
+ // this.redirectTriggers = (redirectStream == null) ? null : redirectTriggers;
+ // }
+ /**
+ * flushes the internal EventWriter
+ *
+ * @throws javax.xml.stream.XMLStreamException
+ */
+ public void flushRedirectStream() throws XMLStreamException {
+ redirectWriter.flush();
+ }
- /**
- * the namespaceContext of the last startelement event read
- *
- * @return
- */
- public NamespaceContext getCurrentNamespaceContext() {
- return currentNamespaceContext;
- }
+ /**
+ * the namespaceContext of the last startelement event read
+ *
+ * @return
+ */
+ public NamespaceContext getCurrentNamespaceContext() {
+ return currentNamespaceContext;
+ }
}
diff --git a/utils/src/main/java/at/gv/egiz/slbinding/impl/TransformsInfoType.java b/utils/src/main/java/at/gv/egiz/slbinding/impl/TransformsInfoType.java
index b4e988f0..1180e9fa 100644
--- a/utils/src/main/java/at/gv/egiz/slbinding/impl/TransformsInfoType.java
+++ b/utils/src/main/java/at/gv/egiz/slbinding/impl/TransformsInfoType.java
@@ -25,6 +25,7 @@ import java.io.ByteArrayOutputStream;
import java.util.HashSet;
import java.util.Set;
import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLStreamException;
import org.apache.commons.logging.Log;
diff --git a/utils/src/main/java/at/gv/egiz/slbinding/impl/XMLContentType.java b/utils/src/main/java/at/gv/egiz/slbinding/impl/XMLContentType.java
index c32542aa..eb147f88 100644
--- a/utils/src/main/java/at/gv/egiz/slbinding/impl/XMLContentType.java
+++ b/utils/src/main/java/at/gv/egiz/slbinding/impl/XMLContentType.java
@@ -35,7 +35,7 @@ import org.apache.commons.logging.LogFactory;
public class XMLContentType extends at.buergerkarte.namespaces.securitylayer._1.XMLContentType implements RedirectCallback {
@XmlTransient
- private static Log log = LogFactory.getLog(TransformsInfoType.class);
+ private static Log log = LogFactory.getLog(XMLContentType.class);
@XmlTransient
protected ByteArrayOutputStream redirectOS = null;
diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectFactory.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectFactory.java
index 4ab376f1..fae77451 100644
--- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectFactory.java
+++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/ObjectFactory.java
@@ -167,6 +167,7 @@ public class ObjectFactory {
*
*/
public TransformType createTransformType() {
+// return new at.gv.egiz.slbinding.impl.TransformType();
return new TransformType();
}
diff --git a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformsType.java b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformsType.java
index 584baf80..c7044c4c 100644
--- a/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformsType.java
+++ b/utils/src/main/java/org/w3/_2000/_09/xmldsig_/TransformsType.java
@@ -57,7 +57,7 @@ import javax.xml.bind.annotation.XmlType;
})
public class TransformsType {
- @XmlElement(name = "Transform", required = true)
+ @XmlElement(name = "Transform", required = true) //, type=at.gv.egiz.slbinding.impl.TransformType.class)
protected List transform;
/**
diff --git a/utils/src/test/java/at/gv/egiz/slbinding/RedirectTest.java b/utils/src/test/java/at/gv/egiz/slbinding/RedirectTest.java
index 99d353ac..7c8c206a 100644
--- a/utils/src/test/java/at/gv/egiz/slbinding/RedirectTest.java
+++ b/utils/src/test/java/at/gv/egiz/slbinding/RedirectTest.java
@@ -52,6 +52,8 @@ import javax.xml.stream.XMLEventReader;
import javax.xml.stream.XMLInputFactory;
import static org.junit.Assert.*;
+import org.w3._2000._09.xmldsig_.TransformType;
+import org.w3._2000._09.xmldsig_.TransformsType;
/**
*
@@ -131,11 +133,34 @@ public class RedirectTest {
Iterator tiIt = transformsInfos.iterator();
while (tiIt.hasNext()) {
at.gv.egiz.slbinding.impl.TransformsInfoType ti = (at.gv.egiz.slbinding.impl.TransformsInfoType) tiIt.next();
+// TransformsInfoType ti = tiIt.next();
assertNotNull(ti);
- System.out.println("found at.gv.egiz.slbinding.impl.TransformsInfoType TransformsInfo");
+ System.out.println("found sl:TransformsInfo: " + ti.getClass().getName()); //at.gv.egiz.slbinding.impl.TransformsInfoType TransformsInfo");
+// TransformsType ts = ti.getTransforms();
+// assertNotNull(ts);
+// System.out.println("found dsig:Transforms " + ts.getClass().getName()); //org.w3._2000._09.xmldsig_.TransformsType dsig:Transforms");
+// List tL = ts.getTransform();
+// assertNotNull(tL);
+// System.out.println("found " + tL.size() + " org.w3._2000._09.xmldsig_.TransformType dsig:Transform");
+// for (TransformType t : tL) {
+// if (t instanceof at.gv.egiz.slbinding.impl.TransformType) {
+// System.out.println("found at.gv.egiz.slbinding.impl.TransformType");
+// byte[] redirectedBytes = ((at.gv.egiz.slbinding.impl.TransformType) t).getRedirectedStream().toByteArray();
+// if (redirectedBytes != null && redirectedBytes.length > 0) {
+// System.out.println("reading redirected stream...");
+// os.write("--- redirected Transform ---".getBytes());
+// os.write(redirectedBytes);
+// os.write("\n".getBytes());
+// } else {
+// System.out.println("no redirected stream");
+// }
+// }
+// }
+
ByteArrayOutputStream dsigTransforms = ti.getRedirectedStream();
+ os.write("--- redirected TransformsInfo content ---".getBytes());
os.write(dsigTransforms.toByteArray());
- os.write("\n".getBytes());
+ os.write("\n---".getBytes());
MetaInfoType mi = ti.getFinalDataMetaInfo();
assertNotNull(mi);
diff --git a/utils/src/test/requests/CreateXMLSignatureRequest02.xml_redirect.txt b/utils/src/test/requests/CreateXMLSignatureRequest02.xml_redirect.txt
index 31be50b7..fc0e4f14 100644
--- a/utils/src/test/requests/CreateXMLSignatureRequest02.xml_redirect.txt
+++ b/utils/src/test/requests/CreateXMLSignatureRequest02.xml_redirect.txt
@@ -1,4 +1,4 @@
-
+--- redirected TransformsInfo content ---
@@ -82,7 +82,7 @@
-
+------ redirected TransformsInfo content ---
@@ -162,3 +162,4 @@
+---
\ No newline at end of file
--
cgit v1.2.3
From 28e772965f4fb313aeb5018e6104943a1177bc06 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Tue, 10 Mar 2009 11:10:55 +0000
Subject: pinfield and pinsize label aligned trailing
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@317 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index 08ecaa7f..ef64ac59 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -21,6 +21,7 @@
package at.gv.egiz.bku.gui;
import at.gv.egiz.smcc.PINSpec;
+import at.gv.egiz.smcc.STARCOSCard;
import at.gv.egiz.stal.HashDataInput;
import at.gv.egiz.stal.impl.ByteArrayHashDataInput;
import java.awt.event.ActionEvent;
@@ -46,7 +47,8 @@ public class BKUGUIWorker implements Runnable {
public void run() {
// try {
- final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN", (byte) 0x81, null);
+ final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Test-PIN", (byte) 0x81, null);
+ final PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Test-PIN", (byte) 0x01, null);
final ActionListener cancelListener = new ActionListener() {
--
cgit v1.2.3
From 2a1df5e58e44f8d77f34eb80df74e8c0d27caceb Mon Sep 17 00:00:00 2001
From: clemenso
Date: Wed, 18 Mar 2009 22:27:28 +0000
Subject: 1.1-rc5 (pinProviderFactories, gui refactoring, signatureCard,
secureViewer)
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@322 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../gv/egiz/bku/online/applet/AppletBKUWorker.java | 5 +-
.../bku/online/applet/AppletHashDataDisplay.java | 217 --------
.../egiz/bku/online/applet/AppletSecureViewer.java | 221 ++++++++
.../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 365 +++++++-------
.../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 46 +-
.../bku/online/applet/PINManagementBKUWorker.java | 10 +-
.../smccstal/ext/ManagementPINProviderFactory.java | 53 ++
.../smccstal/ext/PINManagementRequestHandler.java | 319 ++++++------
.../bku/smccstal/ext/PinpadPINProviderFactory.java | 126 +++++
.../smccstal/ext/SoftwarePINProviderFactory.java | 148 ++++++
.../gv/egiz/bku/gui/ActivationMessages.properties | 17 +-
.../egiz/bku/gui/ActivationMessages_en.properties | 15 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 4 +-
.../gv/egiz/bku/smccstal/ext/FileSystemTest.java | 435 ----------------
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 66 ++-
.../main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 560 +++++++++++----------
.../main/java/at/gv/egiz/bku/gui/PinDocument.java | 30 +-
.../at/gv/egiz/bku/gui/Messages.properties | 28 +-
.../at/gv/egiz/bku/gui/Messages_en.properties | 28 +-
.../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 6 +-
.../at/gv/egiz/bku/local/stal/BKUGuiProxy.java | 106 ++--
.../bku/local/stal/LocalSignRequestHandler.java | 4 +-
.../java/at/gv/egiz/bku/local/app/Container.java | 5 -
.../main/webapp/helpfiles/de/cardnotsupported.html | 47 ++
.../main/webapp/helpfiles/de/cardnotsupported.png | Bin 0 -> 2120 bytes
.../webapp/helpfiles/de/help.cardnotsupported.html | 47 --
.../webapp/helpfiles/de/help.cardnotsupported.png | Bin 2120 -> 0 bytes
.../main/webapp/helpfiles/de/help.insertcard.html | 42 --
.../main/webapp/helpfiles/de/help.insertcard.png | Bin 2270 -> 0 bytes
.../src/main/webapp/helpfiles/de/help.wait.html | 39 --
.../src/main/webapp/helpfiles/de/help.wait.png | Bin 1542 -> 0 bytes
.../src/main/webapp/helpfiles/de/help.welcome.html | 40 --
.../src/main/webapp/helpfiles/de/help.welcome.png | Bin 1537 -> 0 bytes
.../src/main/webapp/helpfiles/de/insertcard.html | 42 ++
.../src/main/webapp/helpfiles/de/insertcard.png | Bin 0 -> 2270 bytes
BKUOnline/src/main/webapp/helpfiles/de/wait.html | 39 ++
BKUOnline/src/main/webapp/helpfiles/de/wait.png | Bin 0 -> 1542 bytes
.../src/main/webapp/helpfiles/de/welcome.html | 40 ++
BKUOnline/src/main/webapp/helpfiles/de/welcome.png | Bin 0 -> 1537 bytes
smcc/src/main/java/at/gv/egiz/smcc/ACOS04Card.java | 30 ++
smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java | 410 ++++++++++-----
.../at/gv/egiz/smcc/AbstractSignatureCard.java | 352 +++++++++++--
.../java/at/gv/egiz/smcc/ChangePINProvider.java | 39 ++
.../src/main/java/at/gv/egiz/smcc/PINProvider.java | 26 +-
.../src/main/java/at/gv/egiz/smcc/STARCOSCard.java | 479 +++++++++++-------
smcc/src/main/java/at/gv/egiz/smcc/SWCard.java | 36 +-
.../main/java/at/gv/egiz/smcc/SignatureCard.java | 42 +-
.../java/at/gv/egiz/smcc/SignatureCardFactory.java | 2 +-
.../java/at/gv/egiz/smcc/TimeoutException.java | 39 ++
smcc/src/test/resources/log4j.properties | 2 +-
.../at/gv/egiz/bku/smccstal/AbstractBKUWorker.java | 8 +-
.../gv/egiz/bku/smccstal/AbstractPINProvider.java | 67 +++
.../at/gv/egiz/bku/smccstal/AbstractSMCCSTAL.java | 6 +
.../bku/smccstal/InfoBoxReadRequestHandler.java | 40 +-
.../gv/egiz/bku/smccstal/PINProviderFactory.java | 47 ++
.../bku/smccstal/PinpadPINProviderFactory.java | 155 ++++++
.../java/at/gv/egiz/bku/smccstal/SecureViewer.java | 44 ++
.../gv/egiz/bku/smccstal/SignRequestHandler.java | 149 +++---
.../bku/smccstal/SoftwarePINProviderFactory.java | 140 ++++++
.../java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java | 16 +-
60 files changed, 3278 insertions(+), 2001 deletions(-)
delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java
create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletSecureViewer.java
create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java
create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PinpadPINProviderFactory.java
create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/SoftwarePINProviderFactory.java
delete mode 100644 BKUAppletExt/src/test/java/at/gv/egiz/bku/smccstal/ext/FileSystemTest.java
create mode 100644 BKUOnline/src/main/webapp/helpfiles/de/cardnotsupported.html
create mode 100644 BKUOnline/src/main/webapp/helpfiles/de/cardnotsupported.png
delete mode 100644 BKUOnline/src/main/webapp/helpfiles/de/help.cardnotsupported.html
delete mode 100644 BKUOnline/src/main/webapp/helpfiles/de/help.cardnotsupported.png
delete mode 100644 BKUOnline/src/main/webapp/helpfiles/de/help.insertcard.html
delete mode 100644 BKUOnline/src/main/webapp/helpfiles/de/help.insertcard.png
delete mode 100644 BKUOnline/src/main/webapp/helpfiles/de/help.wait.html
delete mode 100644 BKUOnline/src/main/webapp/helpfiles/de/help.wait.png
delete mode 100644 BKUOnline/src/main/webapp/helpfiles/de/help.welcome.html
delete mode 100644 BKUOnline/src/main/webapp/helpfiles/de/help.welcome.png
create mode 100644 BKUOnline/src/main/webapp/helpfiles/de/insertcard.html
create mode 100644 BKUOnline/src/main/webapp/helpfiles/de/insertcard.png
create mode 100644 BKUOnline/src/main/webapp/helpfiles/de/wait.html
create mode 100644 BKUOnline/src/main/webapp/helpfiles/de/wait.png
create mode 100644 BKUOnline/src/main/webapp/helpfiles/de/welcome.html
create mode 100644 BKUOnline/src/main/webapp/helpfiles/de/welcome.png
create mode 100644 smcc/src/main/java/at/gv/egiz/smcc/ACOS04Card.java
create mode 100644 smcc/src/main/java/at/gv/egiz/smcc/ChangePINProvider.java
create mode 100644 smcc/src/main/java/at/gv/egiz/smcc/TimeoutException.java
create mode 100644 smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/AbstractPINProvider.java
create mode 100644 smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PINProviderFactory.java
create mode 100644 smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PinpadPINProviderFactory.java
create mode 100644 smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SecureViewer.java
create mode 100644 smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SoftwarePINProviderFactory.java
(limited to 'BKUCommonGUI/src/test/java')
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
index eb6cf30b..9b9735f6 100644
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletBKUWorker.java
@@ -60,14 +60,15 @@ public class AppletBKUWorker extends AbstractBKUWorker implements Runnable {
@Override
public void run() {
- gui.showWelcomeDialog();
+ gui.showMessageDialog(BKUGUIFacade.TITLE_WELCOME,
+ BKUGUIFacade.MESSAGE_WELCOME);
try {
STALPortType stalPort = applet.getSTALPort();
STALTranslator stalTranslator = applet.getSTALTranslator();
addRequestHandler(SignRequest.class,
- new AppletHashDataDisplay(stalPort, sessionId));
+ new AppletSecureViewer(stalPort, sessionId));
GetNextRequestResponseType nextRequestResp = stalPort.connect(sessionId);
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java
deleted file mode 100644
index 2ed9aa5b..00000000
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java
+++ /dev/null
@@ -1,217 +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.online.applet;
-
-import java.security.DigestException;
-import java.security.MessageDigest;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import at.gv.egiz.bku.smccstal.SignRequestHandler;
-import at.gv.egiz.stal.HashDataInput;
-import at.gv.egiz.stal.impl.ByteArrayHashDataInput;
-import at.gv.egiz.stal.service.GetHashDataInputFault;
-import at.gv.egiz.stal.service.STALPortType;
-import at.gv.egiz.stal.service.types.GetHashDataInputResponseType;
-import at.gv.egiz.stal.service.types.GetHashDataInputType;
-import at.gv.egiz.stal.signedinfo.ReferenceType;
-import java.security.NoSuchAlgorithmException;
-
-/**
- * A SignRequesthandler that obtains hashdata inputs from a STAL webservice and
- * displays these either within the applet or in a separate frame.
- * The internal viewer displays plaintext data only, other mimetypes can be saved to disk.
- * The standalone (frame) viewer displays all mimetypes.
- *
- * (This class depends on STALService and therefore is not part of BKUCommonGUI.)
- *
- * @author Clemens Orthacker
- */
-public class AppletHashDataDisplay extends SignRequestHandler {
-
- private static final Log log = LogFactory.getLog(AppletHashDataDisplay.class);
- protected STALPortType stalPort;
- protected String sessId;
-
- public AppletHashDataDisplay(STALPortType stalPort, String sessId) {
- if (stalPort == null || sessId == null) {
- throw new NullPointerException("STAL port must not be null");
- }
- this.sessId = sessId;
- this.stalPort = stalPort;
- }
-
- /**
- * TODO don't throw exceptions
- * @param signedReferences
- * @throws java.security.DigestException
- * @throws java.lang.Exception
- */
- @Override
- public void displayHashDataInputs(List signedReferences) throws DigestException, Exception {
-
- List hdi = getHashDataInput(signedReferences);
- List verifiedHashDataInputs = verifyHashDataInput(signedReferences, hdi);
-
- if (verifiedHashDataInputs.size() > 0) {
- gui.showHashDataInputDialog(verifiedHashDataInputs, this, "hashDataDone");
- } else {
- throw new Exception("No signature data (apart from any QualifyingProperties or a Manifest)");
- }
- }
-
- /**
- * Get all hashdata inputs that contain an ID attribute but no Type attribute.
- * @param signedReferences
- * @return
- * @throws at.gv.egiz.stal.service.GetHashDataInputFault
- */
- private List getHashDataInput(List signedReferences) throws GetHashDataInputFault, Exception {
- GetHashDataInputType request = new GetHashDataInputType();
- request.setSessionId(sessId);
-
-// HashMap idSignedRefMap = new HashMap();
- for (ReferenceType signedRef : signedReferences) {
- //don't get Manifest, QualifyingProperties, ...
- if (signedRef.getType() == null) {
- String signedRefId = signedRef.getId();
- if (signedRefId != null) {
- if (log.isTraceEnabled()) {
- log.trace("requesting hashdata input for reference " + signedRefId);
- }
-// idSignedRefMap.put(signedRefId, signedRef);
- GetHashDataInputType.Reference ref = new GetHashDataInputType.Reference();
- ref.setID(signedRefId);
- request.getReference().add(ref);
-
- } else {
- throw new Exception("Cannot resolve signature data for dsig:Reference without Id attribute");
- }
- }
- }
-
- if (request.getReference().size() < 1) {
- log.error("No signature data (apart from any QualifyingProperties or a Manifest) for session " + sessId);
- throw new Exception("No signature data (apart from any QualifyingProperties or a Manifest)");
- }
-
- if (log.isDebugEnabled()) {
- log.debug("WebService call GetHashDataInput for " + request.getReference().size() + " references in session " + sessId);
- }
- GetHashDataInputResponseType response = stalPort.getHashDataInput(request);
- return response.getReference();
- }
-
- /**
- * Verifies all signed references and returns STAL HashDataInputs
- * @param signedReferences
- * @param hashDataInputs
- * @return
- * @throws java.security.DigestException
- * @throws java.security.NoSuchAlgorithmException
- * @throws Exception if no hashdata input is provided for a signed reference
- */
- private List verifyHashDataInput(List signedReferences, List hashDataInputs) throws DigestException, NoSuchAlgorithmException, Exception {
-
- ArrayList verifiedHashDataInputs = new ArrayList();
-
- for (ReferenceType signedRef : signedReferences) {
- if (signedRef.getType() == null) {
- log.info("Verifying digest for signed reference " + signedRef.getId());
-
- String signedRefId = signedRef.getId();
- byte[] signedDigest = signedRef.getDigestValue();
- String signedDigestAlg = null;
- if (signedRef.getDigestMethod() != null) {
- signedDigestAlg = signedRef.getDigestMethod().getAlgorithm();
- } else {
- throw new NoSuchAlgorithmException("Failed to verify digest value for reference " + signedRefId + ": no digest algorithm");
- }
-
- // usually, there is just one item here
- GetHashDataInputResponseType.Reference hashDataInput = null;
- for (GetHashDataInputResponseType.Reference hdi : hashDataInputs) {
- if (signedRefId.equals(hdi.getID())) {
- hashDataInput = hdi;
- break;
- }
- }
- if (hashDataInput == null) {
- throw new Exception("No hashdata input for reference " + signedRefId + " returned by service");
- }
-
- byte[] hdi = hashDataInput.getValue();
- String mimeType = hashDataInput.getMimeType();
- String encoding = hashDataInput.getEncoding();
-
- if (hdi == null) {
- throw new Exception("No hashdata input for reference " + signedRefId + " provided by service");
- }
- if (log.isDebugEnabled()) {
- log.debug("Got HashDataInput " + signedRefId + " (" + mimeType + ";" + encoding + ")");
- }
-
- byte[] hashDataInputDigest = digest(hdi, signedDigestAlg);
-
- if (log.isDebugEnabled()) {
- log.debug("Comparing digest values... ");
- }
-// log.warn("***************** DISABLED HASHDATA VERIFICATION");
- if (!Arrays.equals(hashDataInputDigest, signedDigest)) {
- log.error("Bad digest value for reference " + signedRefId);
- throw new DigestException("Bad digest value for reference " + signedRefId);
- }
-
- verifiedHashDataInputs.add(new ByteArrayHashDataInput(hdi, signedRefId, mimeType, encoding));
- }
- }
-
- return verifiedHashDataInputs;
- }
-
- //TODO
- private byte[] digest(byte[] hashDataInput, String mdAlg) throws NoSuchAlgorithmException {
- if ("http://www.w3.org/2000/09/xmldsig#sha1".equals(mdAlg)) {
- mdAlg = "SHA-1";
- } else if ("http://www.w3.org/2001/04/xmlenc#sha256".equals(mdAlg)) {
- mdAlg = "SHA-256";
- } else if ("http://www.w3.org/2001/04/xmlenc#sha224".equals(mdAlg)) {
- mdAlg = "SHA-224";
- } else if ("http://www.w3.org/2001/04/xmldsig-more#sha224".equals(mdAlg)) {
- mdAlg = "SHA-224";
- } else if ("http://www.w3.org/2001/04/xmldsig-more#sha384".equals(mdAlg)) {
- mdAlg = "SHA-384";
- } else if ("http://www.w3.org/2001/04/xmlenc#sha512".equals(mdAlg)) {
- mdAlg = "SHA-512";
- } else if ("http://www.w3.org/2001/04/xmldsig-more#md2".equals(mdAlg)) {
- mdAlg = "MD2";
- } else if ("http://www.w3.org/2001/04/xmldsig-more#md5".equals(mdAlg)) {
- mdAlg = "MD5";
- } else if ("http://www.w3.org/2001/04/xmlenc#ripemd160".equals(mdAlg)) {
- mdAlg = "RipeMD-160";
- } else {
- throw new NoSuchAlgorithmException("Failed to verify digest value: unsupported digest algorithm " + mdAlg);
- }
-
- MessageDigest md = MessageDigest.getInstance(mdAlg);
- return md.digest(hashDataInput);
- }
-}
diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletSecureViewer.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletSecureViewer.java
new file mode 100644
index 00000000..e2551e2d
--- /dev/null
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletSecureViewer.java
@@ -0,0 +1,221 @@
+/*
+ * 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.online.applet;
+
+import at.gv.egiz.bku.smccstal.SecureViewer;
+import java.security.DigestException;
+import java.security.MessageDigest;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import at.gv.egiz.bku.smccstal.SignRequestHandler;
+import at.gv.egiz.stal.HashDataInput;
+import at.gv.egiz.stal.impl.ByteArrayHashDataInput;
+import at.gv.egiz.stal.service.GetHashDataInputFault;
+import at.gv.egiz.stal.service.STALPortType;
+import at.gv.egiz.stal.service.types.GetHashDataInputResponseType;
+import at.gv.egiz.stal.service.types.GetHashDataInputType;
+import at.gv.egiz.stal.signedinfo.ReferenceType;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * A SignRequesthandler that obtains hashdata inputs from a STAL webservice and
+ * displays these either within the applet or in a separate frame.
+ * The internal viewer displays plaintext data only, other mimetypes can be saved to disk.
+ * The standalone (frame) viewer displays all mimetypes.
+ *
+ * (This class depends on STALService and therefore is not part of BKUCommonGUI.)
+ *
+ * @author Clemens Orthacker
+ */
+public class AppletSecureViewer extends SignRequestHandler {
+
+ private static final Log log = LogFactory.getLog(AppletSecureViewer.class);
+ protected STALPortType stalPort;
+ protected String sessId;
+
+ public AppletSecureViewer(STALPortType stalPort, String sessId) {
+ if (stalPort == null || sessId == null) {
+ throw new NullPointerException("STAL port must not be null");
+ }
+ this.sessId = sessId;
+ this.stalPort = stalPort;
+ }
+
+ /**
+ * TODO don't throw exceptions
+ * @param signedReferences
+ * @throws java.security.DigestException
+ * @throws java.lang.Exception
+ */
+ @Override
+ public void displayDataToBeSigned(List signedReferences)
+ throws DigestException, Exception {
+
+ List hdi = getHashDataInput(signedReferences);
+ List verifiedHashDataInputs = verifyHashDataInput(signedReferences, hdi);
+
+ if (verifiedHashDataInputs.size() > 0) {
+ gui.showSecureViewer(verifiedHashDataInputs, this, "hashDataDone");
+ } else {
+ throw new Exception("No signature data (apart from any QualifyingProperties or a Manifest)");
+ }
+ }
+
+ /**
+ * Get all hashdata inputs that contain an ID attribute but no Type attribute.
+ * @param signedReferences
+ * @return
+ * @throws at.gv.egiz.stal.service.GetHashDataInputFault
+ */
+ private List getHashDataInput(List signedReferences)
+ throws GetHashDataInputFault, Exception {
+ GetHashDataInputType request = new GetHashDataInputType();
+ request.setSessionId(sessId);
+
+// HashMap