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.
+ Elektronisches Lernprogramm zur Handhabung von FinanzOnline und Durchführung der Arbeitnehmerveranlagung
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ 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 @@
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 5124914a..4a338f23 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,16 +17,23 @@
package at.gv.egiz.bku.gui;
public class BKUGUIFactory {
+
+ public static final String SIMPLE_GUI = "simple";
+ public static final String ADVANCED_GUI = "advanced";
+
private static BKUGUIFactory instance = new BKUGUIFactory();
private BKUGUIFactory() {
}
- protected BKUGUIFacade createNewGUI() {
+ protected BKUGUIFacade createNewGUI(String style) {
+ if (ADVANCED_GUI.equals(style)) {
+ return new BKUGUI();
+ }
return new SimpleGUI();
}
- public static BKUGUIFacade createGUI() {
- return instance.createNewGUI();
+ public static BKUGUIFacade createGUI(String style) {
+ return instance.createNewGUI(style);
}
}
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 0bdff867..c5736648 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
@@ -50,7 +50,7 @@ public class SMCCSTALFactory implements STALFactory {
resourceBundle = ResourceBundle.getBundle(BKUApplet.RESOURCE_BUNDLE_BASE);
}
dialog = new JDialog();
- BKUGUIFacade gui = BKUGUIFactory.createGUI();
+ BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI);
gui.init(dialog.getContentPane(), locale.toString(), null);
stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog, resourceBundle);
dialog.setPreferredSize(new Dimension(400, 200));
diff --git a/BKUOnline/src/main/webapp/appletPage.jsp b/BKUOnline/src/main/webapp/appletPage.jsp
index 903c762d..950141c4 100644
--- a/BKUOnline/src/main/webapp/appletPage.jsp
+++ b/BKUOnline/src/main/webapp/appletPage.jsp
@@ -51,11 +51,13 @@
height :<%=height%>
};
var parameters = {
- background : '<%=backgroundImg%>',
+ GuiStyle : 'simple',
+ Background : '<%=backgroundImg%>',
WSDL_URL :'../stal?wsdl',
+ HashDataDisplay : 'external',
HashDataURL : '../hashDataInput',
SessionID : '<%=session.getId()%>',
- redirectURL : '../bkuResult'
+ RedirectURL : '../bkuResult'
};
var version = '1.6.0_02';
deployJava.runApplet(attributes, parameters, version);
--
cgit v1.2.3
From de95f8219adf98710992b6716778b174bc2d2fcc Mon Sep 17 00:00:00 2001
From: clemenso
Date: Mon, 13 Oct 2008 16:43:46 +0000
Subject: BKUGUI / SimpleGUI aligned
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@109 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
BKUApplet/src/test/resources/appletTest.html | 2 +-
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 112 +++------------------
.../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 104 +++----------------
3 files changed, 26 insertions(+), 192 deletions(-)
(limited to 'BKUCommonGUI/src/main/java')
diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html
index b8a0770e..472000de 100644
--- a/BKUApplet/src/test/resources/appletTest.html
+++ b/BKUApplet/src/test/resources/appletTest.html
@@ -20,7 +20,7 @@
-
+
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 53ec1088..64cd9f50 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
@@ -67,7 +67,7 @@ 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 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;
@@ -192,11 +192,19 @@ public class BKUGUI implements BKUGUIFacade {
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();
+// 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"));
@@ -389,16 +397,12 @@ public class BKUGUI implements BKUGUIFacade {
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
-// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
buttonPanelLayout.setHorizontalGroup(
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));
buttonPanelLayout.setVerticalGroup(
buttonPanelLayout.createSequentialGroup()
-// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(cancelButton));
contentPanel.validate();
@@ -452,16 +456,12 @@ public class BKUGUI implements BKUGUIFacade {
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
-// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
buttonPanelLayout.setHorizontalGroup(
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));
buttonPanelLayout.setVerticalGroup(
buttonPanelLayout.createSequentialGroup()
-// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(cancelButton));
contentPanel.validate();
@@ -522,8 +522,8 @@ public class BKUGUI implements BKUGUIFacade {
});
JLabel infoLabel = new JLabel();
+ infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
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()) {
@@ -593,7 +593,6 @@ public class BKUGUI implements BKUGUIFacade {
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)
@@ -738,7 +737,6 @@ public class BKUGUI implements BKUGUIFacade {
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)
@@ -844,16 +842,12 @@ public class BKUGUI implements BKUGUIFacade {
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
-// buttonPanelLayout.linkSize(cancelButton, okButton, signButton, backButton, saveButton);
buttonPanelLayout.setHorizontalGroup(
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));
buttonPanelLayout.setVerticalGroup(
buttonPanelLayout.createSequentialGroup()
-// buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(okButton));
contentPanel.validate();
@@ -1068,7 +1062,6 @@ public class BKUGUI implements BKUGUIFacade {
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)
@@ -1211,7 +1204,6 @@ public class BKUGUI implements BKUGUIFacade {
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)
@@ -1343,82 +1335,4 @@ public class BKUGUI implements BKUGUIFacade {
}
}
}
-
-// 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/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
index 8e32d67e..e323d195 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
@@ -54,7 +54,6 @@ 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;
@@ -196,14 +195,15 @@ public class SimpleGUI implements BKUGUIFacade {
if (background == null) {
background = this.getClass().getResource(DEFAULT_BACKGROUND);
}
- contentPanel = new ImagePanel(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(); // new ImagePanel(LOGO_RESOURCE); //new JPanel();
+ buttonPanel = new JPanel();
buttonPanel.setOpaque(false);
// headerPanel.setBorder(new TitledBorder("header"));
@@ -570,13 +570,12 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
- .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(infoLabel));
+ 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)));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
@@ -589,7 +588,6 @@ public class SimpleGUI implements BKUGUIFacade {
.addComponent(infoLabel));
// .addGap(signPinLabel.getFont().getSize()));
-
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
@@ -731,9 +729,9 @@ public class SimpleGUI implements BKUGUIFacade {
.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));
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(infoLabel))));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
@@ -1384,82 +1382,4 @@ public class SimpleGUI implements BKUGUIFacade {
}
}
}
-
-// 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;
-// }
-
}
--
cgit v1.2.3
From 43cb317a0eb230205e3c8ba58ae7ce67f9fc5613 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Mon, 13 Oct 2008 16:45:33 +0000
Subject: BKUGUI / SimpleGUI aligned
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@110 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
(limited to 'BKUCommonGUI/src/main/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 64cd9f50..4988ff39 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
@@ -106,7 +106,7 @@ public class BKUGUI implements BKUGUIFacade {
// 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 */
@@ -199,12 +199,12 @@ public class BKUGUI implements BKUGUIFacade {
// contentPanel.setBorder(new TitledBorder("content"));
-// headerPanel = new JPanel();
-// headerPanel.setOpaque(false);
-// mainPanel = new JPanel();
-// mainPanel.setOpaque(false);
-// buttonPanel = new JPanel();
-// buttonPanel.setOpaque(false);
+ 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"));
--
cgit v1.2.3
From 07e77c763ae69e690e9b714586dc45ccccc0e4da Mon Sep 17 00:00:00 2001
From: clemenso
Date: Mon, 13 Oct 2008 16:46:34 +0000
Subject: BKUGUI / SimpleGUI aligned
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@111 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(limited to 'BKUCommonGUI/src/main/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 4988ff39..42f9e518 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
@@ -106,7 +106,7 @@ public class BKUGUI implements BKUGUIFacade {
// 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 */
@@ -199,8 +199,8 @@ public class BKUGUI implements BKUGUIFacade {
// contentPanel.setBorder(new TitledBorder("content"));
- headerPanel = new JPanel();
- headerPanel.setOpaque(false);
+// headerPanel = new JPanel();
+// headerPanel.setOpaque(false);
mainPanel = new JPanel();
mainPanel.setOpaque(false);
buttonPanel = new JPanel();
--
cgit v1.2.3
From e19102048016591ba161453b43a3a47f3d4f180c Mon Sep 17 00:00:00 2001
From: clemenso
Date: Mon, 13 Oct 2008 17:31:43 +0000
Subject: GUI cleanup, BKUGUI HeaderPanel
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@112 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 257 ++++-----------------
.../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 183 +--------------
2 files changed, 47 insertions(+), 393 deletions(-)
(limited to 'BKUCommonGUI/src/main/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 42f9e518..9cba293a 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
@@ -106,19 +106,14 @@ public class BKUGUI implements BKUGUIFacade {
// 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;
-// 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;
@@ -199,8 +194,8 @@ public class BKUGUI implements BKUGUIFacade {
// contentPanel.setBorder(new TitledBorder("content"));
-// headerPanel = new JPanel();
-// headerPanel.setOpaque(false);
+ headerPanel = new JPanel();
+ headerPanel.setOpaque(false);
mainPanel = new JPanel();
mainPanel.setOpaque(false);
buttonPanel = new JPanel();
@@ -210,9 +205,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 = 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));
@@ -241,38 +236,35 @@ public class BKUGUI implements BKUGUIFacade {
// buttonSize = saveButton.getPreferredSize().width;
-// GroupLayout headerPanelLayout = new GroupLayout(headerPanel);
-// headerPanel.setLayout(headerPanelLayout);
+ 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));
+ 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));
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.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(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,7 +286,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-// titleLabel.setText(messages.getString(TITLE_ERROR));
+ titleLabel.setText(messages.getString(TITLE_ERROR));
JLabel waitMsgLabel = new JLabel();
waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
@@ -306,7 +298,6 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(waitMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
@@ -332,22 +323,20 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-// titleLabel.setText(messages.getString(TITLE_WELCOME));
+ titleLabel.setText(messages.getString(TITLE_WELCOME));
JLabel welcomeMsgLabel = new JLabel();
welcomeMsgLabel.setFont(welcomeMsgLabel.getFont().deriveFont(welcomeMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- welcomeMsgLabel.setText(messages.getString(TITLE_WELCOME)); //MESSAGE_WAIT));
+ welcomeMsgLabel.setText(messages.getString(MESSAGE_WAIT));
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(welcomeMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(welcomeMsgLabel));
contentPanel.validate();
@@ -371,7 +360,7 @@ 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));
@@ -382,11 +371,9 @@ public class BKUGUI implements BKUGUIFacade {
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();
@@ -430,22 +417,20 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-// titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED));
+ titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED));
JLabel insertCardMsgLabel = new JLabel();
insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- insertCardMsgLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED)); //MESSAGE_INSERTCARD));
+ 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();
@@ -483,12 +468,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));
@@ -506,7 +491,6 @@ public class BKUGUI implements BKUGUIFacade {
String pinLabel = messages.getString(LABEL_PIN);
cardPinLabel.setText(MessageFormat.format(pinLabel, new Object[]{pinSpec.getLocalizedName()}));
-// JPasswordField cardPINField = new JPasswordField();
pinField = new JPasswordField();
pinField.setText("");
pinField.setDocument(new PINDocument(pinSpec, okButton));
@@ -534,36 +518,6 @@ public class BKUGUI implements BKUGUIFacade {
infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)}));
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);
@@ -588,7 +542,6 @@ public class BKUGUI implements BKUGUIFacade {
.addComponent(pinField))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(infoLabel));
-// .addGap(signPinLabel.getFont().getSize()));
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
@@ -645,11 +598,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));
@@ -732,7 +685,6 @@ public class BKUGUI implements BKUGUIFacade {
.addComponent(pinField))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(infoLabel));
-// .addGap(signPinLabel.getFont().getSize()));
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
@@ -751,49 +703,7 @@ public class BKUGUI implements BKUGUIFacade {
pinField.requestFocusInWindow();
contentPanel.validate();
- }// 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) {
-// mainGroup.addComponent(errorLabel);
-// }
-// mainGroup.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(pinSizeLabel)
-// .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)
-// .addGap(hashDataLabel.getFont().getSize()); //14, 14, 14)
-//
-// if (errorLabel != null) {
-// mainGroup.addComponent(errorLabel)
-// .addGap(errorLabel.getFont().getSize());
-// }
-// mainGroup.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(pinSizeLabel)
-// .addGap(signPinLabel.getFont().getSize());
-//
-// return mainGroup;
-//// 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(pinSizeLabel)
-//// .addGap(signPinLabel.getFont().getSize())
-////
-////
-// }
+ }
});
}
@@ -812,7 +722,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-// titleLabel.setText(messages.getString(TITLE_ERROR));
+ titleLabel.setText(messages.getString(TITLE_ERROR));
String errorMsgPattern = messages.getString(errorMsgKey);
String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams);
@@ -827,11 +737,9 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(errorMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(errorMsgLabel));
JButton okButton = new JButton();
@@ -870,7 +778,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-// titleLabel.setText(messages.getString(TITLE_ERROR));
+ titleLabel.setText(messages.getString(TITLE_ERROR));
String errorMsgPattern = messages.getString(errorMsgKey);
String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams);
@@ -885,11 +793,9 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(errorMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(errorMsgLabel));
contentPanel.validate();
@@ -927,11 +833,9 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(waitMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(waitMsgLabel));
contentPanel.validate();
@@ -956,8 +860,6 @@ public class BKUGUI implements BKUGUIFacade {
if (signedReferences.size() == 1) {
-// final HashDataInput signedRef = signedReferences.get(0);
-
if ("text/plain".equals(signedReferences.get(0).getMimeType())) {
ActionListener saveHashDataListener = new ActionListener() {
@@ -1008,7 +910,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));
@@ -1040,15 +942,6 @@ public class BKUGUI implements BKUGUIFacade {
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
- // 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);
@@ -1073,15 +966,6 @@ public class BKUGUI implements BKUGUIFacade {
.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();
}
});
@@ -1101,7 +985,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));
@@ -1135,61 +1019,6 @@ public class BKUGUI implements BKUGUIFacade {
.addComponent(refIdLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(hashDataScrollPane, 0, 0, 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()));
-
JButton backButton = new JButton();
backButton.setText(messages.getString(BUTTON_BACK));
@@ -1220,8 +1049,6 @@ public class BKUGUI implements BKUGUIFacade {
});
}
-// private DisposableFileChooser fileDialog;
-
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/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
index e323d195..3d47e1cd 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
@@ -114,11 +114,6 @@ public class SimpleGUI 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;
@@ -255,16 +250,13 @@ public class SimpleGUI implements BKUGUIFacade {
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.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());
@@ -306,7 +298,6 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(waitMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
@@ -336,18 +327,16 @@ public class SimpleGUI implements BKUGUIFacade {
JLabel welcomeMsgLabel = new JLabel();
welcomeMsgLabel.setFont(welcomeMsgLabel.getFont().deriveFont(welcomeMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- welcomeMsgLabel.setText(messages.getString(TITLE_WELCOME)); //MESSAGE_WAIT));
+ welcomeMsgLabel.setText(messages.getString(TITLE_WELCOME));
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(welcomeMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(welcomeMsgLabel));
contentPanel.validate();
@@ -382,11 +371,9 @@ public class SimpleGUI implements BKUGUIFacade {
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();
@@ -434,18 +421,16 @@ public class SimpleGUI implements BKUGUIFacade {
JLabel insertCardMsgLabel = new JLabel();
insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
- insertCardMsgLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED)); //MESSAGE_INSERTCARD));
+ insertCardMsgLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED));
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();
@@ -507,7 +492,6 @@ public class SimpleGUI implements BKUGUIFacade {
String pinLabel = messages.getString(LABEL_PIN);
cardPinLabel.setText(MessageFormat.format(pinLabel, new Object[]{pinSpec.getLocalizedName()}));
-// JPasswordField cardPINField = new JPasswordField();
pinField = new JPasswordField();
pinField.setText("");
pinField.setDocument(new PINDocument(pinSpec, okButton));
@@ -535,36 +519,6 @@ public class SimpleGUI implements BKUGUIFacade {
infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)}));
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);
@@ -586,7 +540,6 @@ public class SimpleGUI implements BKUGUIFacade {
.addComponent(pinField))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(infoLabel));
-// .addGap(signPinLabel.getFont().getSize()));
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
@@ -742,7 +695,6 @@ public class SimpleGUI implements BKUGUIFacade {
.addComponent(pinField))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(infoLabel));
-// .addGap(signPinLabel.getFont().getSize()));
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
@@ -772,49 +724,7 @@ public class SimpleGUI implements BKUGUIFacade {
pinField.requestFocusInWindow();
contentPanel.validate();
- }// 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) {
-// mainGroup.addComponent(errorLabel);
-// }
-// mainGroup.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(pinSizeLabel)
-// .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)
-// .addGap(hashDataLabel.getFont().getSize()); //14, 14, 14)
-//
-// if (errorLabel != null) {
-// mainGroup.addComponent(errorLabel)
-// .addGap(errorLabel.getFont().getSize());
-// }
-// mainGroup.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(pinSizeLabel)
-// .addGap(signPinLabel.getFont().getSize());
-//
-// return mainGroup;
-//// 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(pinSizeLabel)
-//// .addGap(signPinLabel.getFont().getSize())
-////
-////
-// }
+ }
});
}
@@ -848,11 +758,9 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(errorMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(errorMsgLabel));
JButton okButton = new JButton();
@@ -907,11 +815,9 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(errorMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(errorMsgLabel));
contentPanel.validate();
@@ -949,11 +855,9 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(waitMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
-// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(waitMsgLabel));
contentPanel.validate();
@@ -978,8 +882,6 @@ public class SimpleGUI implements BKUGUIFacade {
if (signedReferences.size() == 1) {
-// final HashDataInput signedRef = signedReferences.get(0);
-
if ("text/plain".equals(signedReferences.get(0).getMimeType())) {
ActionListener saveHashDataListener = new ActionListener() {
@@ -1062,15 +964,6 @@ public class SimpleGUI implements BKUGUIFacade {
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
- // 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.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD));
backButton.setText(messages.getString(BUTTON_BACK));
@@ -1107,15 +1000,6 @@ public class SimpleGUI implements BKUGUIFacade {
// .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();
}
});
@@ -1169,61 +1053,6 @@ public class SimpleGUI implements BKUGUIFacade {
.addComponent(refIdLabel)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addComponent(hashDataScrollPane, 0, 0, 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()));
-
JButton backButton = new JButton();
backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD));
@@ -1266,8 +1095,6 @@ public class SimpleGUI implements BKUGUIFacade {
}
});
}
-
-// private DisposableFileChooser fileDialog;
private void showSaveHashDataInputDialog(final List signedRefs, final ActionListener okListener, final String okCommand) {
--
cgit v1.2.3
From 11411c3d236e10b237ec1c7a1904e64dc2508551 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Tue, 14 Oct 2008 14:47:06 +0000
Subject: GUI retry error msg
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@115 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
BKUApplet/pom.xml | 7 +
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 143 ++++++++-------------
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 38 ++++++
.../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 138 ++++++++------------
.../at/gv/egiz/bku/gui/Messages.properties | 1 +
.../gv/egiz/stal/service/impl/STALServiceImpl.java | 10 +-
6 files changed, 164 insertions(+), 173 deletions(-)
(limited to 'BKUCommonGUI/src/main/java')
diff --git a/BKUApplet/pom.xml b/BKUApplet/pom.xml
index 130749c5..a20a613d 100644
--- a/BKUApplet/pom.xml
+++ b/BKUApplet/pom.xml
@@ -103,6 +103,13 @@
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+ true
+
+
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 9cba293a..7e0f0447 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
@@ -22,7 +22,6 @@ 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;
import java.awt.Font;
@@ -66,40 +65,7 @@ import org.apache.commons.logging.LogFactory;
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 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;
- 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";
- private static final String TITLE_CARDPIN = "title.cardpin";
- 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 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";
- 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 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 SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix";
protected Container contentPane;
protected ResourceBundle messages;
/** left and right side main panels */
@@ -506,42 +472,47 @@ public class BKUGUI implements BKUGUIFacade {
});
JLabel infoLabel = new JLabel();
- infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
if (numRetries < 0) {
- String pinsizePattern = messages.getString(LABEL_PINSIZE);
- String pinSize = String.valueOf(pinSpec.getMinLength());
- if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
- pinSize += "-" + pinSpec.getMaxLength();
- }
- infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize}));
+ 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()}));
} else {
- infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)}));
- infoLabel.setForeground(ERROR_COLOR);
+ 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);
+ }
+
+ 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);
mainPanelLayout.setHorizontalGroup(
- 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)));
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //))
+ .addComponent(pinsizeLabel))));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
-// .addComponent(hashDataLabel)
-// .addGap(hashDataLabel.getFont().getSize())
+ .addComponent(infoLabel)
+ .addGap(infoLabel.getFont().getSize())
.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(cardPinLabel)
.addComponent(pinField))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(infoLabel));
+ .addComponent(pinsizeLabel));
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
@@ -634,57 +605,57 @@ public class BKUGUI implements BKUGUIFacade {
}
});
- //pinsize or error label
+ 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}));
+
JLabel infoLabel = new JLabel();
- infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
if (numRetries < 0) {
- String pinsizePattern = messages.getString(LABEL_PINSIZE);
- String pinSize = String.valueOf(pinSpec.getMinLength());
- if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
- pinSize += "-" + pinSpec.getMaxLength();
- }
- infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize}));
+ infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ infoLabel.setText(messages.getString(MESSAGE_HASHDATALINK));
+ infoLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ infoLabel.setForeground(HYPERLINK_COLOR);
+ infoLabel.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseClicked(MouseEvent me) {
+ ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand);
+ hashdataListener.actionPerformed(e);
+ }
+ });
} else {
- infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)}));
- infoLabel.setForeground(ERROR_COLOR);
+ 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);
}
- 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) {
- ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand);
- hashdataListener.actionPerformed(e);
- }
- });
-
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(hashDataLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
+ .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
- .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(infoLabel))));
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(pinsizeLabel))));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(hashDataLabel)
- .addGap(hashDataLabel.getFont().getSize())
+ .addComponent(infoLabel)
+ .addGap(infoLabel.getFont().getSize())
.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(signPinLabel)
.addComponent(pinField))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(infoLabel));
+ .addComponent(pinsizeLabel));
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
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 0b617271..a5b7d606 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
@@ -18,6 +18,7 @@ package at.gv.egiz.bku.gui;
import at.gv.egiz.stal.HashDataInput;
import at.gv.egiz.smcc.PINSpec;
+import java.awt.Color;
import java.awt.Container;
import java.awt.event.ActionListener;
import java.net.URL;
@@ -34,6 +35,43 @@ public interface BKUGUIFacade {
public static final String ERR_WRITE_HASHDATA = "error.write.hashdata";
public static final String ERR_INVALID_HASH = "error.invalid.hash";
+ public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages";
+ 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;
+ 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 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 ERROR_NO_HASHDATA = "error.no.hashdata";
+
+ 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 SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix";
+
+
public void init(Container contentPane, String localeString, URL background);
public void showWelcomeDialog();
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 3d47e1cd..c37704e2 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
@@ -22,7 +22,6 @@ 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;
import java.awt.Font;
@@ -66,40 +65,7 @@ import org.apache.commons.logging.LogFactory;
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 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;
- 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";
- private static final String TITLE_CARDPIN = "title.cardpin";
- 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 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";
- 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 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 SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix";
protected Container contentPane;
protected ResourceBundle messages;
/** left and right side main panels */
@@ -507,39 +473,47 @@ 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) {
- String pinsizePattern = messages.getString(LABEL_PINSIZE);
- String pinSize = String.valueOf(pinSpec.getMinLength());
- if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
- pinSize += "-" + pinSpec.getMaxLength();
- }
- infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize}));
+ 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()}));
} else {
- infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)}));
- infoLabel.setForeground(ERROR_COLOR);
+ 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);
+ }
+
+ 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);
mainPanelLayout.setHorizontalGroup(
- 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)));
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) //))
+ .addComponent(pinsizeLabel))));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
-// .addComponent(hashDataLabel)
-// .addGap(hashDataLabel.getFont().getSize())
+ .addComponent(infoLabel)
+ .addGap(infoLabel.getFont().getSize())
.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(cardPinLabel)
.addComponent(pinField))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(infoLabel));
+ .addComponent(pinsizeLabel));
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
@@ -644,57 +618,57 @@ public class SimpleGUI implements BKUGUIFacade {
}
});
- //pinsize or error label
+ 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}));
+
JLabel infoLabel = new JLabel();
- 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());
- if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
- pinSize += "-" + pinSpec.getMaxLength();
- }
- infoLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize}));
+ infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ infoLabel.setText(messages.getString(MESSAGE_HASHDATALINK));
+ infoLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+ infoLabel.setForeground(HYPERLINK_COLOR);
+ infoLabel.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseClicked(MouseEvent me) {
+ ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand);
+ hashdataListener.actionPerformed(e);
+ }
+ });
} else {
- infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)}));
- infoLabel.setForeground(ERROR_COLOR);
+ 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);
}
- 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) {
- ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, hashdataCommand);
- hashdataListener.actionPerformed(e);
- }
- });
-
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(hashDataLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
+ .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
.addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(infoLabel))));
+ .addComponent(pinsizeLabel))));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(hashDataLabel)
- .addGap(hashDataLabel.getFont().getSize())
+ .addComponent(infoLabel)
+ .addGap(infoLabel.getFont().getSize())
.addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
.addComponent(signPinLabel)
.addComponent(pinField))
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(infoLabel));
+ .addComponent(pinsizeLabel));
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
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 e7716ae9..d0e4726e 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
@@ -27,6 +27,7 @@ windowtitle.savedir=Signaturdaten in Verzeichnis speichern
windowtitle.overwrite=Datei \u00FCberschreiben?
message.wait=Bitte warten...
message.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken
+message.enterpin=Bitte {0} eingeben
message.hashdatalink=Signaturdaten anzeigen...
message.hashdata=Ein Signaturdatenobjekt:
#message.hashdata=Referenz Id: {0}
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 55e66685..99398fe6 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
@@ -314,15 +314,15 @@ public class STALServiceImpl implements STALPortType {
log.info("Received TestSession GetNextRequest(ErrorResponse), returning QuitRequest");
response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(new QuitRequestType());
} else {
- log.info("Received TestSession GetNextRequest, returning InfoboxReadRequest ");
- SignRequestType sig = new SignRequestType();
- sig.setKeyIdentifier("SecureSignatureKeypair");
- sig.setSignedInfo("id('signed-data-object-0-1214921968-27971781-13578')/node()H1IePEEfGQ2SG03H6LTzw1TpCuM=yV6Q+I60buqR4mMaxA7fi+CV35A=".getBytes());
- response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(sig);
+ log.info("Received TestSession GetNextRequest, returning SignRequest and 3 InfoboxReadRequests ");
InfoboxReadRequestType req = new InfoboxReadRequestType();
req.setInfoboxIdentifier("IdentityLink");
req.setDomainIdentifier("hansiwurzel");
response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(req);
+ SignRequestType sig = new SignRequestType();
+ sig.setKeyIdentifier("SecureSignatureKeypair");
+ sig.setSignedInfo("id('signed-data-object-0-1214921968-27971781-13578')/node()H1IePEEfGQ2SG03H6LTzw1TpCuM=yV6Q+I60buqR4mMaxA7fi+CV35A=".getBytes());
+ response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(sig);
req = new InfoboxReadRequestType();
req.setInfoboxIdentifier("CertifiedKeypair");
response.getInfoboxReadRequestOrSignRequestOrQuitRequest().add(req);
--
cgit v1.2.3
From d56504bc815d41ac9142967915b7e6224c2cf529 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Wed, 15 Oct 2008 13:41:21 +0000
Subject: remove hashdatainputproxy
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@119 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../at/gv/egiz/bku/online/applet/BKUWorker.java | 5 ----
.../gv/egiz/stal/impl/ByteArrayHashDataInput.java | 31 ++++++++++++++++++++++
.../at/gv/egiz/bku/gui/Messages.properties | 2 +-
.../stal/service/impl/STALRequestBrokerImpl.java | 9 +++----
.../at/gv/egiz/stal/util/HashDataInputProxy.java | 2 +-
5 files changed, 36 insertions(+), 13 deletions(-)
(limited to 'BKUCommonGUI/src/main/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 350925ce..3f64de3d 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
@@ -154,11 +154,6 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
return;
}
-// //TODO factory for SignRequestHandler providing either WebServiceHDISignRequestHandler or ExternalHDIDisplaySignRequestHandler
-// AppletContext ctx = parent.getAppletContext();
-// log.debug("register SignRequestHandler for HashDataURL " + hashDataURL);
-// addRequestHandler(at.gv.egiz.stal.SignRequest.class, new ExternalDisplaySignRequestHandler(ctx, hashDataURL));
-
try {
String sessionId = parent.getMyAppletParameter(BKUApplet.SESSION_ID);
if (sessionId == null) {
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java b/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java
index b0285345..2b5ee7e7 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/stal/impl/ByteArrayHashDataInput.java
@@ -7,7 +7,11 @@ package at.gv.egiz.stal.impl;
import at.gv.egiz.stal.HashDataInput;
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;
/**
*
@@ -15,6 +19,8 @@ import java.io.InputStream;
*/
public class ByteArrayHashDataInput implements HashDataInput {
+ private static final Log log = LogFactory.getLog(ByteArrayHashDataInput.class);
+
protected byte[] hashData;
protected String id;
protected String mimeType;
@@ -30,6 +36,31 @@ public class ByteArrayHashDataInput implements HashDataInput {
this.encoding = encoding;
}
+ /**
+ * caches the hashdata input's stream
+ * @param hdi to be cached
+ */
+ public ByteArrayHashDataInput(HashDataInput hdi) {
+ if (hdi == null) {
+ throw new NullPointerException("HashDataInput not provided.");
+ }
+ InputStream is = hdi.getHashDataInput();
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try {
+ byte[] buffer = new byte[1024];
+ for (int i = is.read(buffer); i > -1; i = is.read(buffer)) {
+ baos.write(buffer, 0, i);
+ }
+ this.hashData = baos.toByteArray();
+ } catch (IOException ex) {
+ log.error("Failed to cache provided HashDataInput: " + ex.getMessage(), ex);
+ this.hashData = new byte[0];
+ }
+ this.id = hdi.getReferenceId();
+ this.mimeType = hdi.getMimeType();
+ this.encoding = hdi.getEncoding();
+ }
+
@Override
public String getReferenceId() {
return id;
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 d0e4726e..a38e2cf8 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,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/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 03c7c601..7f4a9273 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
@@ -32,7 +32,6 @@ import at.gv.egiz.stal.service.types.QuitRequestType;
import at.gv.egiz.stal.service.types.RequestType;
import at.gv.egiz.stal.service.types.ResponseType;
import at.gv.egiz.stal.service.types.SignRequestType;
-import at.gv.egiz.stal.util.HashDataInputProxy;
import at.gv.egiz.stal.util.STALTranslator;
import java.util.ArrayList;
import java.util.Collections;
@@ -42,7 +41,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
- * An instance of STALRequestBroker is shared between a producer threads (SLCommand)
+ * An instance of STALRequestBroker is shared between a producer thread (SLCommand)
* and multiple consumer threads (STALService).
* This implementation assures that handleRequest is executed only once the previous invocation returned.
* The BindingProcessor assures that a new SLCommand calls handleRequest() only once
@@ -109,10 +108,8 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
req.setKeyIdentifier(((SignRequest) stalRequest).getKeyIdentifier());
req.setSignedInfo(((SignRequest) stalRequest).getSignedInfo());
requests.add(req);
- for (HashDataInput hdi : ((SignRequest) stalRequest).getHashDataInput()) {
- hashDataInputs.add(new HashDataInputProxy(hdi));
- }
- //hashDataInputs.addAll(((SignRequest) stalRequest).getHashDataInput());
+ //DataObjectHashDataInput with reference caching enabled DataObject
+ hashDataInputs.addAll(((SignRequest) stalRequest).getHashDataInput());
break;
} else if (stalRequest instanceof InfoboxReadRequest) {
log.trace("Received InfoboxReadRequest");
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
index dda20968..01d207d2 100644
--- a/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java
+++ b/STALService/src/main/java/at/gv/egiz/stal/util/HashDataInputProxy.java
@@ -13,7 +13,7 @@ import at.gv.egiz.stal.HashDataInput;
/**
* Enables multiple read requests.
- *
+ * @deprecated use at.gv.egiz.stal.impl.ByteArrayHashDataInput
*/
public class HashDataInputProxy implements HashDataInput {
--
cgit v1.2.3
From 73c8f359ff94b382324665ca981b0640cc9f058f Mon Sep 17 00:00:00 2001
From: clemenso
Date: Thu, 16 Oct 2008 13:11:22 +0000
Subject: Background Chipperling
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@123 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 2 +-
.../src/main/resources/images/BackgroundChipperling.png | Bin 0 -> 3367 bytes
.../src/main/resources/images/BackgroundMocca.png | Bin 0 -> 1287 bytes
3 files changed, 1 insertion(+), 1 deletion(-)
create mode 100644 BKUCommonGUI/src/main/resources/images/BackgroundChipperling.png
create mode 100644 BKUCommonGUI/src/main/resources/images/BackgroundMocca.png
(limited to 'BKUCommonGUI/src/main/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 a5b7d606..ced74834 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -36,7 +36,7 @@ public interface BKUGUIFacade {
public static final String ERR_INVALID_HASH = "error.invalid.hash";
public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages";
- public static final String DEFAULT_BACKGROUND = "/images/mocca_default.png"; //logo.png";
+ public static final String DEFAULT_BACKGROUND = "/images/BackgroundChipperling.png";
public static final String HASHDATA_FONT = "Monospaced";
public static final Color ERROR_COLOR = Color.RED;
public static final Color HYPERLINK_COLOR = Color.BLUE;
diff --git a/BKUCommonGUI/src/main/resources/images/BackgroundChipperling.png b/BKUCommonGUI/src/main/resources/images/BackgroundChipperling.png
new file mode 100644
index 00000000..a4791a7f
Binary files /dev/null and b/BKUCommonGUI/src/main/resources/images/BackgroundChipperling.png differ
diff --git a/BKUCommonGUI/src/main/resources/images/BackgroundMocca.png b/BKUCommonGUI/src/main/resources/images/BackgroundMocca.png
new file mode 100644
index 00000000..349d9ff0
Binary files /dev/null and b/BKUCommonGUI/src/main/resources/images/BackgroundMocca.png differ
--
cgit v1.2.3
From c2ae3db1bc6dcb8ba3eb3461c05e293917c004ca Mon Sep 17 00:00:00 2001
From: mcentner
Date: Thu, 30 Oct 2008 10:33:29 +0000
Subject: Updated SMCC to use exclusive access and to throw exceptions upon
locked or not activated cards. Improved locale support in the security layer
request and response processing. Fixed issue in STAL which prevented the use
of RSA-SHA1 signatures. Added additional parameters to the applet test pages.
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@128 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../main/java/at/gv/egiz/bku/gui/PinDocument.java | 2 +-
.../egiz/bku/online/webapp/BKURequestHandler.java | 20 +-
BKUOnline/src/main/webapp/HTTP-ohne.html | 11 +-
BKUOnline/src/main/webapp/appletPage.jsp | 29 +-
.../at/gv/egiz/stal/util/JCEAlgorithmNames.java | 4 +-
.../gv/egiz/bku/binding/HTTPBindingProcessor.java | 3 +-
.../gv/egiz/bku/slcommands/SLCommandContext.java | 17 +-
.../impl/CreateXMLSignatureCommandImpl.java | 4 +-
.../egiz/bku/slcommands/impl/ErrorResultImpl.java | 42 ++-
.../slcommands/impl/InfoboxReadCommandImpl.java | 2 +-
.../gv/egiz/bku/slcommands/impl/SLResultImpl.java | 8 +-
.../bku/slcommands/impl/ErrorResultImplTest.java | 3 +-
smcc/src/main/java/at/gv/egiz/smcc/ACOSCard.java | 348 ++++++++++++---------
.../at/gv/egiz/smcc/AbstractSignatureCard.java | 169 +++++++---
.../at/gv/egiz/smcc/FileNotFoundException.java | 38 +++
.../main/java/at/gv/egiz/smcc/LockedException.java | 38 +++
.../at/gv/egiz/smcc/NotActivatedException.java | 44 +++
.../src/main/java/at/gv/egiz/smcc/STARCOSCard.java | 339 ++++++++++++--------
smcc/src/main/java/at/gv/egiz/smcc/SWCard.java | 79 ++++-
.../at/gv/egiz/smcc/SignatureCardException.java | 2 +-
.../java/at/gv/egiz/smcc/SignatureCardFactory.java | 223 +++++++++++--
.../java/at/gv/egiz/smcc/util/SmartCardIO.java | 3 +-
.../test/java/at/gv/egiz/smcc/STARCOSCardTest.java | 92 ++++++
.../bku/smccstal/InfoBoxReadRequestHandler.java | 8 +
.../gv/egiz/bku/smccstal/SignRequestHandler.java | 10 +-
25 files changed, 1149 insertions(+), 389 deletions(-)
create mode 100644 smcc/src/main/java/at/gv/egiz/smcc/FileNotFoundException.java
create mode 100644 smcc/src/main/java/at/gv/egiz/smcc/LockedException.java
create mode 100644 smcc/src/main/java/at/gv/egiz/smcc/NotActivatedException.java
create mode 100644 smcc/src/test/java/at/gv/egiz/smcc/STARCOSCardTest.java
(limited to 'BKUCommonGUI/src/main/java')
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 8ae9d7a3..2054ae86 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
@@ -46,7 +46,7 @@ class PINDocument extends PlainDocument {
@Override
public void insertString(int offs, String str, AttributeSet a) throws BadLocationException {
- if (pinSpec.getMaxLength() >= (getLength() + str.length())) {
+ if (pinSpec.getMaxLength() < 0 || 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));
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java
index 6f3b9d7f..9092e3f9 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/BKURequestHandler.java
@@ -44,6 +44,8 @@ import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage;
*/
public class BKURequestHandler extends SpringBKUServlet {
+ private static final long serialVersionUID = 1L;
+
public final static String REDIRECT_URL = "appletPage.jsp";
protected Log log = LogFactory.getLog(BKURequestHandler.class);
@@ -105,6 +107,8 @@ public class BKURequestHandler extends SpringBKUServlet {
String width = getStringFromStream(bindingProcessor.getFormData("appletWidth"), charset);
String height = getStringFromStream(bindingProcessor.getFormData("appletHeight"), charset);
String background = getStringFromStream(bindingProcessor.getFormData("appletBackground"), charset);
+ String guiStyle = getStringFromStream(bindingProcessor.getFormData("appletGuiStyle"), charset);
+ String hashDataDisplay = getStringFromStream(bindingProcessor.getFormData("appletHashDataDisplay"), charset);
if (width != null) {
try {
log.trace("Found applet width parameter: " + width);
@@ -124,12 +128,16 @@ public class BKURequestHandler extends SpringBKUServlet {
}
}
if (background != null) {
- try {
- log.trace("Found applet background parameter: " + background);
- session.setAttribute("appletBackground", background);
- } catch (NumberFormatException nfe) {
- log.warn(nfe);
- }
+ log.trace("Found applet background parameter: " + background);
+ session.setAttribute("appletBackground", background);
+ }
+ if (guiStyle != null) {
+ log.trace("Found applet GUI style parameter: " + guiStyle);
+ session.setAttribute("appletGuiStyle", guiStyle);
+ }
+ if (hashDataDisplay != null) {
+ log.trace("Found applet hash data display parameter: " + hashDataDisplay);
+ session.setAttribute("appletHashDataDisplay", hashDataDisplay);
}
resp.sendRedirect(REDIRECT_URL);
diff --git a/BKUOnline/src/main/webapp/HTTP-ohne.html b/BKUOnline/src/main/webapp/HTTP-ohne.html
index 1923113e..044432ce 100644
--- a/BKUOnline/src/main/webapp/HTTP-ohne.html
+++ b/BKUOnline/src/main/webapp/HTTP-ohne.html
@@ -92,8 +92,17 @@ legend {
name="appletHeight" value="130" id="appletHeight">
+
+
+ simple
+ advanced
+
+
+
+ external
+ internal
+
-
-
+
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
index 7e0f0447..27841d1c 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
@@ -41,6 +41,7 @@ import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.swing.GroupLayout;
+import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
@@ -66,6 +67,8 @@ public class BKUGUI implements BKUGUIFacade {
private static final Log log = LogFactory.getLog(BKUGUI.class);
+ protected HelpMouseListener helpListener;
+
protected Container contentPane;
protected ResourceBundle messages;
/** left and right side main panels */
@@ -89,7 +92,7 @@ public class BKUGUI implements BKUGUIFacade {
* @param localeString may be null
*/
@Override
- public void init(final Container contentPane, String localeString, final URL background) {
+ public void init(final Container contentPane, String localeString, final URL background, ActionListener helpListener) {
if (localeString != null) {
messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString));
@@ -98,6 +101,7 @@ public class BKUGUI implements BKUGUIFacade {
}
this.contentPane = contentPane;
+ registerHelpListener(helpListener);
try {
@@ -175,6 +179,11 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() |
java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2));
+ JLabel helpLabel = new JLabel();
+ helpLabel.setIcon(new ImageIcon(getClass().getResource(HELP_IMG)));
+ helpLabel.addMouseListener(helpListener);
+ helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+
JButton b = new JButton();
b.setText(messages.getString(BUTTON_CANCEL));
if (b.getPreferredSize().width > buttonSize)
@@ -204,15 +213,17 @@ public class BKUGUI implements BKUGUIFacade {
GroupLayout headerPanelLayout = new GroupLayout(headerPanel);
headerPanel.setLayout(headerPanelLayout);
-//
+
headerPanelLayout.setHorizontalGroup(
headerPanelLayout.createSequentialGroup()
- .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
- .addContainerGap());
+ .addComponent(titleLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel));
headerPanelLayout.setVerticalGroup(
- headerPanelLayout.createSequentialGroup()
- .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
-
+ headerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) //SequentialGroup()
+ .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
+ .addComponent(helpLabel));
+
GroupLayout contentPanelLayout = new GroupLayout(contentPanel);
contentPanel.setLayout(contentPanelLayout);
@@ -234,7 +245,7 @@ public class BKUGUI implements BKUGUIFacade {
.addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) //, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addContainerGap()); //);
+ .addContainerGap());
}
@Override
@@ -291,6 +302,8 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_WELCOME));
+ helpListener.setHelpTopic(HELP_WELCOME);
+
JLabel welcomeMsgLabel = new JLabel();
welcomeMsgLabel.setFont(welcomeMsgLabel.getFont().deriveFont(welcomeMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
welcomeMsgLabel.setText(messages.getString(MESSAGE_WAIT));
@@ -300,10 +313,10 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(welcomeMsgLabel));
+ .addComponent(welcomeMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(welcomeMsgLabel));
+ .addComponent(welcomeMsgLabel));
contentPanel.validate();
@@ -328,6 +341,8 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_INSERTCARD));
+ helpListener.setHelpTopic(HELP_INSERTCARD);
+
JLabel insertCardMsgLabel = new JLabel();
insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
insertCardMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD));
@@ -385,6 +400,8 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED));
+ helpListener.setHelpTopic(HELP_CARDNOTSUPPORTED);
+
JLabel insertCardMsgLabel = new JLabel();
insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
insertCardMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD));
@@ -476,10 +493,12 @@ public class BKUGUI implements BKUGUIFacade {
infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
String infoPattern = messages.getString(MESSAGE_ENTERPIN);
infoLabel.setText(MessageFormat.format(infoPattern, new Object[] {pinSpec.getLocalizedName()}));
+ helpListener.setHelpTopic(HELP_CARDPIN);
} else {
infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD));
infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)}));
infoLabel.setForeground(ERROR_COLOR);
+ helpListener.setHelpTopic(HELP_RETRY);
}
JLabel pinsizeLabel = new JLabel();
@@ -496,7 +515,7 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
@@ -506,13 +525,13 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(infoLabel)
- .addGap(infoLabel.getFont().getSize())
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(cardPinLabel)
- .addComponent(pinField))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(pinsizeLabel));
+ .addComponent(infoLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(cardPinLabel)
+ .addComponent(pinField))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(pinsizeLabel));
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
@@ -628,10 +647,12 @@ public class BKUGUI implements BKUGUIFacade {
hashdataListener.actionPerformed(e);
}
});
+ helpListener.setHelpTopic(HELP_SIGNPIN);
} else {
infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD));
infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)}));
infoLabel.setForeground(ERROR_COLOR);
+ helpListener.setHelpTopic(HELP_RETRY);
}
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
@@ -640,22 +661,22 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
- .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(pinsizeLabel))));
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(pinsizeLabel))));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
.addComponent(infoLabel)
- .addGap(infoLabel.getFont().getSize())
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(signPinLabel)
- .addComponent(pinField))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(pinsizeLabel));
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(signPinLabel)
+ .addComponent(pinField))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(pinsizeLabel));
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
@@ -695,6 +716,8 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_ERROR));
+ helpListener.setHelpTopic(errorMsgKey);
+
String errorMsgPattern = messages.getString(errorMsgKey);
String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams);
@@ -708,10 +731,10 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(errorMsgLabel));
+ .addComponent(errorMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(errorMsgLabel));
+ .addComponent(errorMsgLabel));
JButton okButton = new JButton();
okButton.setText(messages.getString(BUTTON_OK));
@@ -751,6 +774,8 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_ERROR));
+ helpListener.setHelpTopic(errorMsgKey);
+
String errorMsgPattern = messages.getString(errorMsgKey);
String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams);
@@ -764,10 +789,10 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(errorMsgLabel));
+ .addComponent(errorMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(errorMsgLabel));
+ .addComponent(errorMsgLabel));
contentPanel.validate();
}
@@ -791,6 +816,8 @@ public class BKUGUI implements BKUGUIFacade {
// titleLabel.setText(messages.getString(TITLE_WAIT));
+ helpListener.setHelpTopic(HELP_WAIT);
+
JLabel waitMsgLabel = new JLabel();
waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
if (waitMessage != null) {
@@ -804,10 +831,10 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(waitMsgLabel));
+ .addComponent(waitMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(waitMsgLabel));
+ .addComponent(waitMsgLabel));
contentPanel.validate();
}
@@ -883,6 +910,8 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_HASHDATA));
+ helpListener.setHelpTopic(HELP_HASHDATA);
+
JLabel refIdLabel = new JLabel();
refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
refIdLabel.setText(messages.getString(MESSAGE_HASHDATA)); //MessageFormat.format(refIdLabelPattern, new Object[]{refId}));
@@ -904,14 +933,14 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(refIdLabel)
- .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
+ .addComponent(refIdLabel)
+ .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(refIdLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
+ .addComponent(refIdLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
JButton backButton = new JButton();
backButton.setText(messages.getString(BUTTON_BACK));
@@ -958,6 +987,8 @@ public class BKUGUI implements BKUGUIFacade {
titleLabel.setText(messages.getString(TITLE_HASHDATA));
+ helpListener.setHelpTopic(HELP_HASHDATALIST);
+
JLabel refIdLabel = new JLabel();
refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
String refIdLabelPattern = messages.getString(MESSAGE_HASHDATALIST);
@@ -982,15 +1013,15 @@ public class BKUGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(refIdLabel)
- .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
+ .addComponent(refIdLabel)
+ .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(refIdLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(hashDataScrollPane, 0, 0, hashDataTable.getPreferredSize().height+3));
-
+ .addComponent(refIdLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(hashDataScrollPane, 0, 0, hashDataTable.getPreferredSize().height+3));
+
JButton backButton = new JButton();
backButton.setText(messages.getString(BUTTON_BACK));
backButton.setActionCommand(cancelCommand);
@@ -1133,4 +1164,19 @@ public class BKUGUI implements BKUGUIFacade {
}
}
}
+
+ private void registerHelpListener(ActionListener helpListener) {
+ if (helpListener != null) {
+ this.helpListener = new HelpMouseListener(helpListener);
+ } else {
+ log.error("no help listener provided, will not be able to display help");
+ this.helpListener = new HelpMouseListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ log.error("no help listener registered (requested help topic: " + e.getActionCommand() + ")");
+ }
+ });
+ }
+ }
}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index ced74834..6c157e76 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -37,6 +37,7 @@ public interface BKUGUIFacade {
public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages";
public static final String DEFAULT_BACKGROUND = "/images/BackgroundChipperling.png";
+ public static final String HELP_IMG = "/images/help.png";
public static final String HASHDATA_FONT = "Monospaced";
public static final Color ERROR_COLOR = Color.RED;
public static final Color HYPERLINK_COLOR = Color.BLUE;
@@ -63,6 +64,15 @@ public interface BKUGUIFacade {
public static final String LABEL_PIN = "label.pin";
public static final String LABEL_PINSIZE = "label.pinsize";
// public static final String ERROR_NO_HASHDATA = "error.no.hashdata";
+ public static final String HELP_WELCOME = "help.welcome";
+ public static final String HELP_WAIT = "help.wait";
+ public static final String HELP_CARDNOTSUPPORTED = "help.cardnotsupported";
+ public static final String HELP_INSERTCARD = "help.insertcard";
+ public static final String HELP_CARDPIN = "help.cardpin";
+ public static final String HELP_SIGNPIN = "help.signpin";
+ public static final String HELP_RETRY = "help.retry";
+ public static final String HELP_HASHDATA = "help.hashdata";
+ public static final String HELP_HASHDATALIST = "help.hashdatalist";
public static final String BUTTON_OK = "button.ok";
public static final String BUTTON_CANCEL = "button.cancel";
@@ -72,9 +82,9 @@ public interface BKUGUIFacade {
public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix";
- public void init(Container contentPane, String localeString, URL background);
+ public void init(Container contentPane, String localeString, URL background, ActionListener helpListener);
- public void showWelcomeDialog();
+ public void showWelcomeDialog();
/**
* MOA-ID only
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java
new file mode 100644
index 00000000..6d814f01
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpMouseListener.java
@@ -0,0 +1,33 @@
+package at.gv.egiz.bku.gui;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class HelpMouseListener extends MouseAdapter {
+
+ protected static final Log log = LogFactory.getLog(HelpMouseListener.class);
+
+ protected ActionListener externalHelpListener;
+ protected String locale;
+ protected String topic;
+
+ public HelpMouseListener(ActionListener externalHelpListener) {
+ super();
+ this.externalHelpListener = externalHelpListener;
+ }
+
+ public void setHelpTopic(String topic) {
+ log.trace("setting help topic: " + topic);
+ this.topic = topic;
+ }
+
+ @Override
+ public void mouseClicked(MouseEvent arg0) {
+ ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, topic);
+ externalHelpListener.actionPerformed(e);
+ }
+}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
index c37704e2..29913d2a 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
@@ -41,6 +41,7 @@ import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import javax.swing.GroupLayout;
+import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFileChooser;
@@ -65,6 +66,8 @@ import org.apache.commons.logging.LogFactory;
public class SimpleGUI implements BKUGUIFacade {
private static final Log log = LogFactory.getLog(SimpleGUI.class);
+
+ protected HelpMouseListener helpListener;
protected Container contentPane;
protected ResourceBundle messages;
@@ -77,6 +80,7 @@ public class SimpleGUI implements BKUGUIFacade {
protected JPanel buttonPanel;
/** right side fixed labels */
// protected JLabel titleLabel;
+ protected JLabel helpLabel;
/** remember the pinfield to return to worker */
protected JPasswordField pinField;
@@ -89,7 +93,7 @@ public class SimpleGUI implements BKUGUIFacade {
* @param localeString may be null
*/
@Override
- public void init(final Container contentPane, String localeString, final URL background) {
+ public void init(final Container contentPane, String localeString, final URL background, ActionListener helpListener) {
if (localeString != null) {
messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString));
@@ -98,7 +102,8 @@ public class SimpleGUI implements BKUGUIFacade {
}
this.contentPane = contentPane;
-
+ registerHelpListener(helpListener);
+
try {
log.debug("scheduling gui initialization");
@@ -131,7 +136,7 @@ public class SimpleGUI implements BKUGUIFacade {
throw new RuntimeException("Failed to init GUI: " + ex.getMessage());
}
}
-
+
// protected void initIconPanel() {
// iconPanel = new JPanel();
// JLabel iconLabel = new JLabel();
@@ -151,7 +156,7 @@ public class SimpleGUI implements BKUGUIFacade {
// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //);
// }
- protected void initContentPanel(URL background) {
+ protected void initContentPanel(URL background) {
if (background == null) {
background = this.getClass().getResource(DEFAULT_BACKGROUND);
@@ -175,6 +180,11 @@ public class SimpleGUI implements BKUGUIFacade {
// titleLabel.setFont(titleLabel.getFont().deriveFont(titleLabel.getFont().getStyle() |
// java.awt.Font.BOLD, titleLabel.getFont().getSize() + 2));
+ helpLabel = new JLabel();
+ helpLabel.setIcon(new ImageIcon(getClass().getResource(HELP_IMG)));
+ helpLabel.addMouseListener(helpListener);
+ helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
+
JButton b = new JButton();
// b.setText(messages.getString(BUTTON_CANCEL));
// if (b.getPreferredSize().width > buttonSize)
@@ -207,8 +217,7 @@ public class SimpleGUI implements BKUGUIFacade {
//
// headerPanelLayout.setHorizontalGroup(
// headerPanelLayout.createSequentialGroup()
-// .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
-// .addContainerGap());
+// .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
// headerPanelLayout.setVerticalGroup(
// headerPanelLayout.createSequentialGroup()
// .addComponent(titleLabel, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
@@ -234,7 +243,7 @@ public class SimpleGUI implements BKUGUIFacade {
.addComponent(mainPanel, 0, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) //, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonPanel, 0, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addContainerGap()); //);
+ .addContainerGap());
}
@Override
@@ -291,6 +300,8 @@ public class SimpleGUI implements BKUGUIFacade {
// titleLabel.setText(messages.getString(TITLE_WELCOME));
+ helpListener.setHelpTopic(HELP_WELCOME);
+
JLabel welcomeMsgLabel = new JLabel();
welcomeMsgLabel.setFont(welcomeMsgLabel.getFont().deriveFont(welcomeMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
welcomeMsgLabel.setText(messages.getString(TITLE_WELCOME));
@@ -299,12 +310,16 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
- .addComponent(welcomeMsgLabel));
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel))
+ .addComponent(welcomeMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(welcomeMsgLabel));
-
+ .addComponent(helpLabel)
+ .addComponent(welcomeMsgLabel));
+
contentPanel.validate();
}
@@ -328,6 +343,8 @@ public class SimpleGUI implements BKUGUIFacade {
// titleLabel.setText(messages.getString(TITLE_INSERTCARD));
+ helpListener.setHelpTopic(HELP_INSERTCARD);
+
JLabel insertCardMsgLabel = new JLabel();
insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
insertCardMsgLabel.setText(messages.getString(MESSAGE_INSERTCARD));
@@ -336,10 +353,14 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel))
.addComponent(insertCardMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
+ .addComponent(helpLabel)
.addComponent(insertCardMsgLabel));
// JButton cancelButton = new JButton();
@@ -385,6 +406,8 @@ public class SimpleGUI implements BKUGUIFacade {
// titleLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED));
+ helpListener.setHelpTopic(HELP_CARDNOTSUPPORTED);
+
JLabel insertCardMsgLabel = new JLabel();
insertCardMsgLabel.setFont(insertCardMsgLabel.getFont().deriveFont(insertCardMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
insertCardMsgLabel.setText(messages.getString(TITLE_CARD_NOT_SUPPORTED));
@@ -393,12 +416,16 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel))
.addComponent(insertCardMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
+ .addComponent(helpLabel)
.addComponent(insertCardMsgLabel));
-
+
// JButton cancelButton = new JButton();
// cancelButton.setText(messages.getString(BUTTON_CANCEL));
// cancelButton.addActionListener(cancelListener);
@@ -477,10 +504,12 @@ public class SimpleGUI implements BKUGUIFacade {
infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
String infoPattern = messages.getString(MESSAGE_ENTERPIN);
infoLabel.setText(MessageFormat.format(infoPattern, new Object[] {pinSpec.getLocalizedName()}));
+ helpListener.setHelpTopic(HELP_CARDPIN);
} else {
infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD));
infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)}));
infoLabel.setForeground(ERROR_COLOR);
+ helpListener.setHelpTopic(HELP_RETRY);
}
JLabel pinsizeLabel = new JLabel();
@@ -497,7 +526,10 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(cardPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
@@ -507,13 +539,15 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(infoLabel)
- .addGap(infoLabel.getFont().getSize())
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(cardPinLabel)
- .addComponent(pinField))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(pinsizeLabel));
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(infoLabel)
+ .addComponent(helpLabel))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(cardPinLabel)
+ .addComponent(pinField))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(pinsizeLabel));
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
@@ -580,7 +614,7 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.removeAll();
buttonPanel.removeAll();
-
+
// if (numRetries < 0) {
// titleLabel.setText(messages.getString(TITLE_SIGN));
// } else {
@@ -626,7 +660,7 @@ public class SimpleGUI implements BKUGUIFacade {
pinSize += "-" + pinSpec.getMaxLength();
}
pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize}));
-
+
JLabel infoLabel = new JLabel();
if (numRetries < 0) {
infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
@@ -641,10 +675,12 @@ public class SimpleGUI implements BKUGUIFacade {
hashdataListener.actionPerformed(e);
}
});
+ helpListener.setHelpTopic(HELP_SIGNPIN);
} else {
infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() | java.awt.Font.BOLD));
infoLabel.setText(MessageFormat.format(messages.getString(MESSAGE_RETRIES), new Object[]{String.valueOf(numRetries)}));
infoLabel.setForeground(ERROR_COLOR);
+ helpListener.setHelpTopic(HELP_RETRY);
}
GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
@@ -652,23 +688,28 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(mainPanelLayout.createSequentialGroup()
.addComponent(infoLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addGroup(mainPanelLayout.createSequentialGroup()
- .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
- .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(pinsizeLabel))));
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(pinsizeLabel))));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
.addComponent(infoLabel)
- .addGap(infoLabel.getFont().getSize())
- .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(signPinLabel)
- .addComponent(pinField))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(pinsizeLabel));
+ .addComponent(helpLabel))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(signPinLabel)
+ .addComponent(pinField))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(pinsizeLabel));
GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
buttonPanel.setLayout(buttonPanelLayout);
@@ -719,6 +760,8 @@ public class SimpleGUI implements BKUGUIFacade {
// titleLabel.setText(messages.getString(TITLE_ERROR));
+ helpListener.setHelpTopic(errorMsgKey);
+
String errorMsgPattern = messages.getString(errorMsgKey);
String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams);
@@ -731,12 +774,16 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
- .addComponent(errorMsgLabel));
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel))
+ .addComponent(errorMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(errorMsgLabel));
-
+ .addComponent(helpLabel)
+ .addComponent(errorMsgLabel));
+
JButton okButton = new JButton();
okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD));
okButton.setText(messages.getString(BUTTON_OK));
@@ -776,6 +823,8 @@ public class SimpleGUI implements BKUGUIFacade {
// titleLabel.setText(messages.getString(TITLE_ERROR));
+ helpListener.setHelpTopic(errorMsgKey);
+
String errorMsgPattern = messages.getString(errorMsgKey);
String errorMsg = MessageFormat.format(errorMsgPattern, errorMsgParams);
@@ -788,11 +837,15 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
- .addComponent(errorMsgLabel));
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel))
+ .addComponent(errorMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(errorMsgLabel));
+ .addComponent(helpLabel)
+ .addComponent(errorMsgLabel));
contentPanel.validate();
}
@@ -816,6 +869,8 @@ public class SimpleGUI implements BKUGUIFacade {
// titleLabel.setText(messages.getString(TITLE_WAIT));
+ helpListener.setHelpTopic(HELP_WAIT);
+
JLabel waitMsgLabel = new JLabel();
waitMsgLabel.setFont(waitMsgLabel.getFont().deriveFont(waitMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
if (waitMessage != null) {
@@ -828,11 +883,15 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanel.setLayout(mainPanelLayout);
mainPanelLayout.setHorizontalGroup(
- mainPanelLayout.createSequentialGroup()
- .addComponent(waitMsgLabel));
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel))
+ .addComponent(waitMsgLabel));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(waitMsgLabel));
+ .addComponent(helpLabel)
+ .addComponent(waitMsgLabel));
contentPanel.validate();
}
@@ -907,6 +966,8 @@ public class SimpleGUI implements BKUGUIFacade {
buttonPanel.removeAll();
// titleLabel.setText(messages.getString(TITLE_HASHDATA));
+
+ helpListener.setHelpTopic(HELP_HASHDATA);
JLabel refIdLabel = new JLabel();
refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
@@ -929,14 +990,19 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(refIdLabel)
- .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addComponent(refIdLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel))
+ .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(refIdLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(refIdLabel)
+ .addComponent(helpLabel))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
JButton backButton = new JButton();
backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD));
@@ -995,6 +1061,8 @@ public class SimpleGUI implements BKUGUIFacade {
// titleLabel.setText(messages.getString(TITLE_HASHDATA));
+ helpListener.setHelpTopic(HELP_HASHDATALIST);
+
JLabel refIdLabel = new JLabel();
refIdLabel.setFont(refIdLabel.getFont().deriveFont(refIdLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
String refIdLabelPattern = messages.getString(MESSAGE_HASHDATALIST);
@@ -1019,14 +1087,19 @@ public class SimpleGUI implements BKUGUIFacade {
mainPanelLayout.setHorizontalGroup(
mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(refIdLabel)
- .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addComponent(refIdLabel)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel))
+ .addComponent(hashDataScrollPane, 0, 0, Short.MAX_VALUE));
mainPanelLayout.setVerticalGroup(
mainPanelLayout.createSequentialGroup()
- .addComponent(refIdLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(hashDataScrollPane, 0, 0, hashDataTable.getPreferredSize().height+3));
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(refIdLabel)
+ .addComponent(helpLabel))
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(hashDataScrollPane, 0, 0, hashDataTable.getPreferredSize().height+3));
JButton backButton = new JButton();
backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD));
@@ -1183,4 +1256,19 @@ public class SimpleGUI implements BKUGUIFacade {
}
}
}
+
+ private void registerHelpListener(ActionListener helpListener) {
+ if (helpListener != null) {
+ this.helpListener = new HelpMouseListener(helpListener);
+ } else {
+ log.error("no help listener provided, will not be able to display help");
+ this.helpListener = new HelpMouseListener(new ActionListener() {
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ log.error("no help listener registered (requested help topic: " + e.getActionCommand() + ")");
+ }
+ });
+ }
+ }
}
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index a38e2cf8..5a427360 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -26,12 +26,12 @@ windowtitle.save=Signaturdaten speichern
windowtitle.savedir=Signaturdaten in Verzeichnis speichern
windowtitle.overwrite=Datei \u00FCberschreiben?
message.wait=Bitte warten...
-message.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken
-message.enterpin=Bitte {0} eingeben
-message.hashdatalink=Signaturdaten anzeigen...
-message.hashdata=Ein Signaturdatenobjekt:
+message.insertcard=Bitte die B\u00FCrgerkarte in den Kartenleser stecken
+message.enterpin={0} eingeben
+message.hashdatalink=Signaturdaten anzeigen
+message.hashdata=Signaturdaten:
#message.hashdata=Referenz Id: {0}
-message.hashdatalist={0} Signaturdatenobjekte:
+message.hashdatalist={0} Signaturdaten:
message.retries=Noch {0} Versuch(e)
message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?
label.pin={0}:
diff --git a/BKUCommonGUI/src/main/resources/images/help.png b/BKUCommonGUI/src/main/resources/images/help.png
new file mode 100644
index 00000000..4ed65a97
Binary files /dev/null and b/BKUCommonGUI/src/main/resources/images/help.png differ
diff --git a/BKUOnline/src/main/webapp/appletPage.jsp b/BKUOnline/src/main/webapp/appletPage.jsp
index ffb67828..8ddbed13 100644
--- a/BKUOnline/src/main/webapp/appletPage.jsp
+++ b/BKUOnline/src/main/webapp/appletPage.jsp
@@ -52,9 +52,10 @@
var parameters = {
GuiStyle : '<%=guiStyle%>',
Background : '<%=backgroundImg%>',
- WSDL_URL : '../stal?wsdl',
- HashDataDisplay : '<%=hashDataDisplay%>',
- HashDataURL : '../hashDataInput',
+ WSDL_URL :'../stal?wsdl',
+ HelpURL : '../help',
+ HashDataDisplay : 'external',
+ HashDataURL : '../hashDataInput',
SessionID : '<%=session.getId()%>',
RedirectURL : '../bkuResult'
};
--
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/main/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 4032e46810c24dc3f013de296a2133f4651696b9 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Fri, 31 Oct 2008 15:30:34 +0000
Subject: local HelpListener card locked/not activated
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@137 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../egiz/bku/online/applet/AppletHelpListener.java | 46 ++++++++
.../at/gv/egiz/bku/online/applet/BKUApplet.java | 4 +-
.../bku/online/applet/ExternalHelpListener.java | 83 --------------
.../at/gv/egiz/bku/gui/AbstractHelpListener.java | 84 +++++++++++++++
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 2 +
.../at/gv/egiz/bku/gui/Messages.properties | 4 +-
BKULocal/pom.xml | 119 ++++++++++-----------
.../gv/egiz/bku/local/gui/LocalHelpListener.java | 41 +++++++
.../at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 11 +-
BKUOnline/src/main/webapp/HTTP-ohne.html | 2 +-
.../bku/smccstal/InfoBoxReadRequestHandler.java | 7 ++
.../gv/egiz/bku/smccstal/SignRequestHandler.java | 6 ++
12 files changed, 260 insertions(+), 149 deletions(-)
create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java
delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java
create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java
create mode 100644 BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
(limited to 'BKUCommonGUI/src/main/java')
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
new file mode 100644
index 00000000..a0305eb4
--- /dev/null
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHelpListener.java
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+/**
+ *
+ * @author clemens
+ */
+public class AppletHelpListener extends AbstractHelpListener {
+
+ protected AppletContext ctx;
+
+ public AppletHelpListener(AppletContext ctx, URL helpURL, String 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 470534da..2b0188bb 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
@@ -82,10 +82,10 @@ public class BKUApplet extends JApplet {
}
String guiStyle = getMyAppletParameter(GUI_STYLE);
BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle);
- ExternalHelpListener helpListener = null;
+ AppletHelpListener helpListener = null;
try {
URL helpURL = getMyAppletParameterURL(HELP_URL);
- helpListener = new ExternalHelpListener(getAppletContext(), helpURL, localeString);
+ helpListener = new AppletHelpListener(getAppletContext(), helpURL, localeString);
} catch (MalformedURLException ex) {
log.error("invalid help URL: " + ex.getMessage());
}
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
deleted file mode 100644
index f92a6963..00000000
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalHelpListener.java
+++ /dev/null
@@ -1,83 +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.applet.AppletContext;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.net.MalformedURLException;
-import java.net.URL;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- *
- * @author clemens
- */
-public class ExternalHelpListener implements ActionListener {
-
- protected final static Log log = LogFactory.getLog(ExternalHelpListener.class);
- protected AppletContext ctx;
- protected String helpURLBase;
- protected String locale;
-
- public ExternalHelpListener(AppletContext ctx, URL helpURL, String locale) {
- if (ctx == null) {
- throw new RuntimeException("no applet context provided");
- }
- if (helpURL == null || "".equals(helpURL)) {
- throw new RuntimeException("no help URL provided");
- }
- this.ctx = ctx;
- this.helpURLBase = helpURL.toString();
- this.locale = locale;
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- log.debug("received help action: " + e.getActionCommand());
- URL helpURL;
- try {
- String urlString = helpURLBase;
- if (locale != null) {
- urlString = appendParameter(urlString, "locale", locale);
- }
- if (e.getActionCommand() != null && !"".equals(e.getActionCommand())) {
- urlString = appendParameter(urlString, "topic", e.getActionCommand());
- }
- helpURL = new URL(urlString);
- } catch (MalformedURLException ex) {
- try {
- log.error("failed to create help URL: " + ex.getMessage());
- helpURL = new URL(helpURLBase);
- } catch (MalformedURLException ex1) {
- log.error("failed to create default help URL, requested help will not be displayed");
- return;
- }
- }
- ctx.showDocument(helpURL, "_blank");
- }
-
- private String appendParameter(String url, String paramName, String paramValue) {
- if (url.indexOf('?') < 0) {
- return url + "?" + paramName + "=" + paramValue;
- } else {
- return url + "&" + paramName + "=" + paramValue;
- }
- }
-}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java
new file mode 100644
index 00000000..68d61bef
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/AbstractHelpListener.java
@@ -0,0 +1,84 @@
+/*
+ * 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;
+import java.awt.event.ActionListener;
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public abstract class AbstractHelpListener implements ActionListener {
+
+ protected final static Log log = LogFactory.getLog(AbstractHelpListener.class);
+ protected String helpURLBase;
+ protected String locale;
+
+ public AbstractHelpListener(URL baseURL, String locale) {
+ if (baseURL == null || "".equals(baseURL)) {
+ throw new RuntimeException("no help URL provided");
+ }
+ this.helpURLBase = baseURL.toString();
+ this.locale = locale;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ log.debug("received help action: " + e.getActionCommand());
+ URL helpURL;
+ try {
+ String urlString = helpURLBase;
+ if (locale != null) {
+ urlString = appendParameter(urlString, "locale", locale);
+ }
+ if (e.getActionCommand() != null && !"".equals(e.getActionCommand())) {
+ urlString = appendParameter(urlString, "topic", e.getActionCommand());
+ }
+ helpURL = new URL(urlString);
+ } catch (MalformedURLException ex) {
+ try {
+ log.error("failed to create help URL: " + ex.getMessage());
+ helpURL = new URL(helpURLBase);
+ } catch (MalformedURLException ex1) {
+ log.error("failed to create default help URL, requested help will not be displayed");
+ return;
+ }
+ }
+ try {
+ showDocument(helpURL);
+ } catch (Exception ex) {
+ log.error("could not display help document " + helpURL + ": " + ex.getMessage());
+ }
+ }
+
+ private String appendParameter(String url, String paramName, String paramValue) {
+ if (url.indexOf('?') < 0) {
+ return url + "?" + paramName + "=" + paramValue;
+ } else {
+ return url + "&" + paramName + "=" + paramValue;
+ }
+ }
+
+ public abstract void showDocument(URL helpDocument) 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 872f1874..4ef1b7d9 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
@@ -35,6 +35,8 @@ public interface BKUGUIFacade {
public static final String ERR_DISPLAY_HASHDATA = "error.display.hashdata";
public static final String ERR_WRITE_HASHDATA = "error.write.hashdata";
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 MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages";
public static final String DEFAULT_BACKGROUND = "/images/BackgroundChipperling.png";
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 5a427360..1f51de77 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
@@ -58,4 +58,6 @@ 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
+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
diff --git a/BKULocal/pom.xml b/BKULocal/pom.xml
index 204fa6b9..03a6a10b 100644
--- a/BKULocal/pom.xml
+++ b/BKULocal/pom.xml
@@ -1,25 +1,22 @@
-
-
- bku
- at.gv.egiz
- 1.0-SNAPSHOT
-
- 4.0.0
- at.gv.egiz
- BKULocal
- war
- BKU Local
- 1.0-SNAPSHOT
-
+
+
+ bku
+ at.gv.egiz
+ 1.0-SNAPSHOT
+
+ 4.0.0
+ at.gv.egiz
+ BKULocal
+ war
+ BKU Local
+ 1.0-SNAPSHOTscm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocalscm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocalscm:svn:svn://svn.egovlabs.gv.at/svnroot/mocca/trunk/BKULocal
-
+
@@ -27,15 +24,11 @@
2.0.2
-
- true
-
+ true
-
- ${project.version}-r${buildNumber}
-
+ ${project.version}-r${buildNumber}
@@ -59,47 +52,47 @@
-
-
-
- at.gv.egiz
- STAL
- 1.0-SNAPSHOT
-
-
- at.gv.egiz
- bkucommon
- 1.0-SNAPSHOT
-
-
- at.gv.egiz
- smcc
- 1.0-SNAPSHOT
+
+
+
+ at.gv.egiz
+ STAL
+ 1.0-SNAPSHOT
+
+
+ at.gv.egiz
+ bkucommon
+ 1.0-SNAPSHOT
+
+
+ at.gv.egiz
+ smcc
+ 1.0-SNAPSHOTat.gv.egizsmccSTAL1.0-SNAPSHOT
-
-
- org.springframework
- spring-core
- 2.5.5
-
-
- javax.servlet
- servlet-api
- 2.5
- provided
-
-
- org.springframework
- spring-web
- 2.5.5
-
-
- commons-logging
- commons-logging
+
+
+ org.springframework
+ spring-core
+ 2.5.5
+
+
+ javax.servlet
+ servlet-api
+ 2.5
+ provided
+
+
+ org.springframework
+ spring-web
+ 2.5.5
+
+
+ commons-logging
+ commons-loggingat.gv.egiz
@@ -110,6 +103,10 @@
at.gv.egizBKUViewer1.0-SNAPSHOT
-
-
-
\ No newline at end of file
+
+
+
+
+ Tomcat60
+
+
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
new file mode 100644
index 00000000..ebec9c65
--- /dev/null
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package at.gv.egiz.bku.local.gui;
+
+import at.gv.egiz.bku.gui.AbstractHelpListener;
+import java.awt.Desktop;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class LocalHelpListener extends AbstractHelpListener {
+
+ public LocalHelpListener(URL baseURL, String locale) {
+ super(baseURL, locale);
+ }
+
+ @Override
+ public void showDocument(URL helpDocument) throws IOException, URISyntaxException {
+ Desktop.getDesktop().browse(helpDocument.toURI());
+ }
+
+}
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 df5c2b28..d3530332 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
@@ -18,6 +18,7 @@ package at.gv.egiz.bku.local.stal;
import java.awt.Dimension;
import java.awt.Toolkit;
+import java.net.MalformedURLException;
import java.util.Locale;
import java.util.ResourceBundle;
@@ -26,9 +27,11 @@ import javax.swing.WindowConstants;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.gui.BKUGUIFactory;
+import at.gv.egiz.bku.local.gui.LocalHelpListener;
import at.gv.egiz.bku.online.applet.BKUApplet;
import at.gv.egiz.stal.STAL;
import at.gv.egiz.stal.STALFactory;
+import java.net.URL;
public class SMCCSTALFactory implements STALFactory {
@@ -48,7 +51,13 @@ public class SMCCSTALFactory implements STALFactory {
}
dialog = new JDialog();
BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI);
- gui.init(dialog.getContentPane(), locale.toString(), null, null);
+ LocalHelpListener helpListener =null;
+ try {
+ helpListener = new LocalHelpListener(new URL("http://localhost:3495/help"), "en");
+ } catch (MalformedURLException ex) {
+ ex.printStackTrace();
+ }
+ gui.init(dialog.getContentPane(), locale.toString(), null, helpListener);
stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog, resourceBundle);
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 044432ce..47c059f2 100644
--- a/BKUOnline/src/main/webapp/HTTP-ohne.html
+++ b/BKUOnline/src/main/webapp/HTTP-ohne.html
@@ -98,7 +98,7 @@ legend {
advanced
-
+
external
internal
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java
index cfac8cf5..cfc5c4bd 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java
@@ -16,6 +16,7 @@
*/
package at.gv.egiz.bku.smccstal;
+import at.gv.egiz.bku.gui.BKUGUIFacade;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -104,9 +105,15 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler implements
}
} catch (NotActivatedException e) {
log.info("Citizen card not activated.", e);
+ gui.showErrorDialog(BKUGUIFacade.ERR_CARD_NOTACTIVATED, null, this, null);
+ waitForAction();
+ gui.showWaitDialog(null);
return new ErrorResponse(6001);
} catch (LockedException e) {
log.info("Citizen card locked.", e);
+ gui.showErrorDialog(BKUGUIFacade.ERR_CARD_LOCKED, null, this, null);
+ waitForAction();
+ gui.showWaitDialog(null);
return new ErrorResponse(6001);
} catch (CancelledException cx) {
log.debug("User cancelled request", cx);
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 466ec2a9..dbc70bff 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
@@ -94,9 +94,15 @@ public abstract class SignRequestHandler extends AbstractRequestHandler implemen
return stalResp;
} catch (NotActivatedException e) {
log.info("Citizen card not activated.", e);
+ gui.showErrorDialog(BKUGUIFacade.ERR_CARD_NOTACTIVATED, null, this, null);
+ waitForAction();
+ gui.showWaitDialog(null);
return new ErrorResponse(6001);
} catch (LockedException e) {
log.info("Citizen card locked.", e);
+ gui.showErrorDialog(BKUGUIFacade.ERR_CARD_LOCKED, null, this, null);
+ waitForAction();
+ gui.showWaitDialog(null);
return new ErrorResponse(6001);
} catch (CancelledException cx) {
log.debug("User cancelled request");
--
cgit v1.2.3
From 9829de9c9b19dcca15676aaf9737195cc059a66c Mon Sep 17 00:00:00 2001
From: clemenso
Date: Mon, 3 Nov 2008 09:37:14 +0000
Subject: local HelpListener DesktopAPI
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@138 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../egiz/bku/online/applet/AppletHelpListener.java | 3 +-
.../at/gv/egiz/bku/online/applet/BKUApplet.java | 6 ++--
.../at/gv/egiz/bku/gui/AbstractHelpListener.java | 7 +++--
.../gv/egiz/bku/local/gui/LocalHelpListener.java | 20 +++++++++---
.../at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 30 +++++++++++++-----
.../egiz/bku/local/webapp/BKURequestHandler.java | 5 +--
.../src/main/webapp/WEB-INF/applicationContext.xml | 36 ++++++++++++----------
7 files changed, 69 insertions(+), 38 deletions(-)
(limited to 'BKUCommonGUI/src/main/java')
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
index a0305eb4..4040431f 100644
--- 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
@@ -20,6 +20,7 @@ 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;
/**
*
@@ -29,7 +30,7 @@ public class AppletHelpListener extends AbstractHelpListener {
protected AppletContext ctx;
- public AppletHelpListener(AppletContext ctx, URL helpURL, String locale) {
+ public AppletHelpListener(AppletContext ctx, URL helpURL, Locale locale) {
super(helpURL, locale);
if (ctx == null) {
throw new RuntimeException("no applet context provided");
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 2b0188bb..50d66d80 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
@@ -65,9 +65,11 @@ public class BKUApplet extends JApplet {
log.debug("Called init()");
HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance());
String localeString = getMyAppletParameter(LOCALE_PARAM_KEY);
+ Locale locale = null;
if (localeString != null) {
+ locale = new Locale(localeString);
resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE,
- new Locale(localeString));
+ locale);
} else {
resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE);
}
@@ -85,7 +87,7 @@ public class BKUApplet extends JApplet {
AppletHelpListener helpListener = null;
try {
URL helpURL = getMyAppletParameterURL(HELP_URL);
- helpListener = new AppletHelpListener(getAppletContext(), helpURL, localeString);
+ helpListener = new AppletHelpListener(getAppletContext(), helpURL, locale);
} catch (MalformedURLException ex) {
log.error("invalid help URL: " + ex.getMessage());
}
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 68d61bef..6e3167c1 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
@@ -21,6 +21,7 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Locale;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -32,9 +33,9 @@ public abstract class AbstractHelpListener implements ActionListener {
protected final static Log log = LogFactory.getLog(AbstractHelpListener.class);
protected String helpURLBase;
- protected String locale;
+ protected Locale locale;
- public AbstractHelpListener(URL baseURL, String locale) {
+ public AbstractHelpListener(URL baseURL, Locale locale) {
if (baseURL == null || "".equals(baseURL)) {
throw new RuntimeException("no help URL provided");
}
@@ -49,7 +50,7 @@ public abstract class AbstractHelpListener implements ActionListener {
try {
String urlString = helpURLBase;
if (locale != null) {
- urlString = appendParameter(urlString, "locale", locale);
+ urlString = appendParameter(urlString, "locale", locale.toString());
}
if (e.getActionCommand() != null && !"".equals(e.getActionCommand())) {
urlString = appendParameter(urlString, "topic", e.getActionCommand());
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
index ebec9c65..e32c9c3d 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
@@ -14,7 +14,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package at.gv.egiz.bku.local.gui;
import at.gv.egiz.bku.gui.AbstractHelpListener;
@@ -22,6 +21,7 @@ import java.awt.Desktop;
import java.io.IOException;
import java.net.URISyntaxException;
import java.net.URL;
+import java.util.Locale;
/**
*
@@ -29,13 +29,25 @@ import java.net.URL;
*/
public class LocalHelpListener extends AbstractHelpListener {
- public LocalHelpListener(URL baseURL, String locale) {
+ protected Desktop desktop;
+
+ public LocalHelpListener(URL baseURL, Locale locale) {
super(baseURL, locale);
+ if (Desktop.isDesktopSupported()) {
+ desktop = Desktop.getDesktop();
+ }
}
@Override
public void showDocument(URL helpDocument) throws IOException, URISyntaxException {
- Desktop.getDesktop().browse(helpDocument.toURI());
+ if (desktop == null) {
+ log.error("Failed to open default browser: Desktop API not available (libgnome installed?)");
+ } else {
+ if (!desktop.isSupported(Desktop.Action.BROWSE)) {
+ log.error("Failed to open default browser: The system provides the Desktop API, but does not support the BROWSE action");
+ } else {
+ Desktop.getDesktop().browse(helpDocument.toURI());
+ }
+ }
}
-
}
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 d3530332..4cc7bcd3 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
@@ -32,30 +32,38 @@ import at.gv.egiz.bku.online.applet.BKUApplet;
import at.gv.egiz.stal.STAL;
import at.gv.egiz.stal.STALFactory;
import java.net.URL;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
public class SMCCSTALFactory implements STALFactory {
- private Locale locale;
+ protected static final Log log = LogFactory.getLog(SMCCSTALFactory.class);
+ protected String helpURL;
+ protected Locale locale;
@Override
public STAL createSTAL() {
-
+
SMCCSTAL stal;
JDialog dialog;
ResourceBundle resourceBundle;
if (locale != null) {
resourceBundle = ResourceBundle.getBundle(BKUApplet.RESOURCE_BUNDLE_BASE,
- locale);
+ locale);
} else {
resourceBundle = ResourceBundle.getBundle(BKUApplet.RESOURCE_BUNDLE_BASE);
}
dialog = new JDialog();
BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI);
- LocalHelpListener helpListener =null;
+ LocalHelpListener helpListener = null;
try {
- helpListener = new LocalHelpListener(new URL("http://localhost:3495/help"), "en");
+ if (helpURL != null) {
+ helpListener = new LocalHelpListener(new URL(helpURL), locale);
+ } else {
+ log.warn("no HELP URL configured, help system disabled");
+ }
} catch (MalformedURLException ex) {
- ex.printStackTrace();
+ log.error("failed to configure help listener: " + ex.getMessage(), ex);
}
gui.init(dialog.getContentPane(), locale.toString(), null, helpListener);
stal = new SMCCSTAL(new BKUGuiProxy(dialog, gui), dialog, resourceBundle);
@@ -72,7 +80,7 @@ public class SMCCSTALFactory implements STALFactory {
frameSize.width = screenSize.width;
}
dialog.setLocation((screenSize.width - frameSize.width) / 2,
- (screenSize.height - frameSize.height) / 2);
+ (screenSize.height - frameSize.height) / 2);
return stal;
}
@@ -80,4 +88,12 @@ public class SMCCSTALFactory implements STALFactory {
public void setLocale(Locale locale) {
this.locale = locale;
}
+
+ public String getHelpURL() {
+ return helpURL;
+ }
+
+ public void setHelpURL(String helpURL) {
+ this.helpURL = helpURL;
+ }
}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java
index f19b86b5..62705d1e 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/BKURequestHandler.java
@@ -16,7 +16,6 @@
*/
package at.gv.egiz.bku.local.webapp;
-import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
@@ -30,12 +29,10 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.web.HttpRequestHandler;
import at.gv.egiz.bku.binding.BindingProcessorManager;
import at.gv.egiz.bku.binding.HTTPBindingProcessor;
import at.gv.egiz.bku.binding.HttpUtil;
-import at.gv.egiz.bku.utils.StreamUtil;
import at.gv.egiz.org.apache.tomcat.util.http.AcceptLanguage;
public abstract class BKURequestHandler extends HttpServlet {
@@ -68,7 +65,7 @@ public abstract class BKURequestHandler extends HttpServlet {
bindingProcessor.setHTTPHeaders(headerMap);
bindingProcessor.consumeRequestStream(req.getInputStream());
- // fixxme just for testing
+ // fixxme just for testing
bindingProcessor.run();
if (bindingProcessor.getRedirectURL() != null) {
resp.sendRedirect(bindingProcessor.getRedirectURL());
diff --git a/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml b/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml
index a951f056..3191f82f 100644
--- a/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml
@@ -1,25 +1,27 @@
-
+
+ scope="singleton">
+
+
Date: Mon, 3 Nov 2008 12:36:42 +0000
Subject: localization
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@140 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../at/gv/egiz/bku/online/applet/BKUApplet.java | 20 ++---
.../at/gv/egiz/bku/online/applet/BKUWorker.java | 17 ++--
.../at/gv/egiz/bku/online/applet/images/logo.png | Bin 4035 -> 0 bytes
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 11 ++-
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 9 ++-
.../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 11 ++-
.../at/gv/egiz/bku/gui/Messages.properties | 86 ++++++++++-----------
.../at/gv/egiz/bku/gui/Messages_de.properties | 62 +++++++++++++++
.../at/gv/egiz/bku/local/stal/BKUGuiProxy.java | 10 ++-
.../java/at/gv/egiz/bku/local/stal/SMCCSTAL.java | 6 +-
.../at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 16 ++--
11 files changed, 156 insertions(+), 92 deletions(-)
delete mode 100644 BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png
create mode 100644 BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties
(limited to 'BKUCommonGUI/src/main/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 50d66d80..bde055ec 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
@@ -40,7 +40,6 @@ public class BKUApplet extends JApplet {
private static Log log = LogFactory.getLog(BKUApplet.class);
public static final String GUI_STYLE = "GuiStyle";
- public final static String RESOURCE_BUNDLE_BASE = "at/gv/egiz/bku/online/applet/Messages";
public final static String LOCALE_PARAM_KEY = "Locale";
public final static String LOGO_URL_KEY = "LogoURL";
public final static String WSDL_URL = "WSDL_URL";
@@ -52,7 +51,6 @@ public class BKUApplet extends JApplet {
public static final String REDIRECT_URL = "RedirectURL";
public static final String REDIRECT_TARGET = "RedirectTarget";
public static final String HASHDATA_DISPLAY_INTERNAL = "internal";
- protected ResourceBundle resourceBundle;
protected BKUWorker worker;
protected Thread workerThread;
@@ -64,14 +62,9 @@ public class BKUApplet extends JApplet {
log.info("Welcome to MOCCA\n");
log.debug("Called init()");
HttpsURLConnection.setDefaultSSLSocketFactory(InternalSSLSocketFactory.getInstance());
- String localeString = getMyAppletParameter(LOCALE_PARAM_KEY);
- Locale locale = null;
- if (localeString != null) {
- locale = new Locale(localeString);
- resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE,
- locale);
- } else {
- resourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE_BASE);
+ String locale = getMyAppletParameter(LOCALE_PARAM_KEY);
+ if (locale != null) {
+ this.setLocale(new Locale(locale));
}
String backgroundString = getMyAppletParameter(BACKGROUND_PARAM);
URL background = null;
@@ -84,15 +77,16 @@ public class BKUApplet extends JApplet {
}
String guiStyle = getMyAppletParameter(GUI_STYLE);
BKUGUIFacade gui = BKUGUIFactory.createGUI(guiStyle);
+ log.debug("setting GUI locale to " + getLocale());
AppletHelpListener helpListener = null;
try {
URL helpURL = getMyAppletParameterURL(HELP_URL);
- helpListener = new AppletHelpListener(getAppletContext(), helpURL, locale);
+ helpListener = new AppletHelpListener(getAppletContext(), helpURL, getLocale());
} catch (MalformedURLException ex) {
log.error("invalid help URL: " + ex.getMessage());
}
- gui.init(getContentPane(), localeString, background, helpListener);
- worker = new BKUWorker(gui, this, resourceBundle);
+ gui.init(getContentPane(), getLocale(), background, helpListener);
+ worker = new BKUWorker(gui, this);
}
@Override
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 78f3dc12..843f6c4c 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
@@ -48,7 +48,6 @@ import at.gv.egiz.stal.service.types.ObjectFactory;
import at.gv.egiz.stal.service.types.RequestType;
import at.gv.egiz.stal.service.types.ResponseType;
import at.gv.egiz.stal.util.STALTranslator;
-import javax.naming.ConfigurationException;
public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
ActionListener, SMCCSTALRequestHandler {
@@ -57,25 +56,22 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
protected BKUGUIFacade gui;
protected BKUApplet parent;
private STALPortType stalPort;
-// private URL hashDataURL;
protected List actionCommandList = new ArrayList();
protected Boolean actionPerformed = false;
protected boolean finished = false;
- protected ResourceBundle errorMessages;
/**
*
* @param gui
* must not be null
*/
- public BKUWorker(BKUGUIFacade gui, BKUApplet parent,
- ResourceBundle errorMessageBundle) {
- if ((gui == null) || (parent == null) || (errorMessageBundle == null)) {
+ public BKUWorker(BKUGUIFacade gui, BKUApplet parent) {
+ if (gui == null || parent == null) {
throw new NullPointerException("Parameter must not be set to null");
}
this.gui = gui;
+ this.locale = gui.getLocale();
this.parent = parent;
- this.errorMessages = errorMessageBundle;
addRequestHandler(QuitRequest.class, this);
// register SignRequestHandler once we have a webservice port
}
@@ -86,9 +82,9 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
* @param gui
* @param errorMessageBundle
*/
- protected BKUWorker(BKUGUIFacade gui, ResourceBundle errorMessageBundle) {
+ protected BKUWorker(BKUGUIFacade gui) {
this.gui = gui;
- this.errorMessages = errorMessageBundle;
+ this.locale = gui.getLocale();
addRequestHandler(QuitRequest.class, this);
}
@@ -342,8 +338,7 @@ public class BKUWorker extends AbstractSMCCSTAL implements Runnable,
}
break;
case SMCCHelper.CARD_FOUND:
- // gui.showWaitDialog(null);
- signatureCard = smccHelper.getSignatureCard(errorMessages.getLocale());
+ signatureCard = smccHelper.getSignatureCard(locale);
return false;
}
smccHelper.update(3000);
diff --git a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png b/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png
deleted file mode 100644
index eee4be4f..00000000
Binary files a/BKUApplet/src/main/resources/at/gv/egiz/bku/online/applet/images/logo.png and /dev/null differ
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 27841d1c..9f733a14 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
@@ -92,10 +92,10 @@ public class BKUGUI implements BKUGUIFacade {
* @param localeString may be null
*/
@Override
- public void init(final Container contentPane, String localeString, final URL background, ActionListener helpListener) {
+ public void init(final Container contentPane, Locale locale, final URL background, ActionListener helpListener) {
- if (localeString != null) {
- messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString));
+ if (locale != null) {
+ messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, locale);
} else {
messages = ResourceBundle.getBundle(MESSAGES_BUNDLE);
}
@@ -248,6 +248,11 @@ public class BKUGUI implements BKUGUIFacade {
.addContainerGap());
}
+ @Override
+ public Locale getLocale() {
+ return messages.getLocale();
+ }
+
@Override
public void showLoginDialog(ActionListener loginListener, String actionCommand) {
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 4ef1b7d9..6655cf64 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
@@ -24,6 +24,7 @@ import java.awt.Container;
import java.awt.event.ActionListener;
import java.net.URL;
import java.util.List;
+import java.util.Locale;
public interface BKUGUIFacade {
@@ -85,7 +86,13 @@ public interface BKUGUIFacade {
public static final String SAVE_HASHDATAINPUT_PREFIX = "save.hashdatainput.prefix";
- public void init(Container contentPane, String localeString, URL background, ActionListener helpListener);
+ 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();
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 195db27a..a005292e 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
@@ -90,10 +90,10 @@ public class SimpleGUI implements BKUGUIFacade {
* @param localeString may be null
*/
@Override
- public void init(final Container contentPane, String localeString, final URL background, ActionListener helpListener) {
+ public void init(final Container contentPane, Locale locale, final URL background, ActionListener helpListener) {
- if (localeString != null) {
- messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString));
+ if (locale != null) {
+ messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, locale);
} else {
messages = ResourceBundle.getBundle(MESSAGES_BUNDLE);
}
@@ -243,6 +243,11 @@ public class SimpleGUI implements BKUGUIFacade {
.addContainerGap());
}
+ @Override
+ public Locale getLocale() {
+ return messages.getLocale();
+ }
+
@Override
public void showLoginDialog(ActionListener loginListener, String actionCommand) {
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 1f51de77..2e6b7b14 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,51 +13,49 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-title.welcome=Willkommen
-title.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken
-title.cardnotsupported=Die Karte wird nicht unterst\u00FCtzt
-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.savedir=Signaturdaten in Verzeichnis speichern
-windowtitle.overwrite=Datei \u00FCberschreiben?
-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=Referenz Id: {0}
-message.hashdatalist={0} Signaturdaten:
-message.retries=Noch {0} Versuch(e)
-message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?
+title.welcome=Welcome
+title.insertcard=Please insert your citizen-card into the reader
+title.cardnotsupported=This card is not supported
+title.cardpin=Enter {0}
+title.sign=Create signature
+title.error=Error
+title.retry=Wrong PIN
+title.wait=Please wait
+title.hashdata=Signature data
+windowtitle.save=Save signature data
+windowtitle.savedir=Save signature data to directory
+windowtitle.overwrite=Overwrite file?
+message.wait=Please wait...
+message.insertcard=Please insert your citizen-card into the reader
+message.enterpin=Enter {0}
+message.hashdatalink=Display signature data
+message.hashdata=Signature data:
+message.hashdatalist={0} signature data objects:
+message.retries={0} tries left
+message.overwrite=Overwrite {0}?
label.pin={0}:
-label.pinsize=({0} stellig)
+label.pinsize=({0} digits)
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)
-save.hashdatainput.prefix=Signaturdaten
+button.cancel=Cancel
+button.back=Back
+button.sign=Sign
+button.save=Save...
+mimetype.desc.xml=XML-files (.xml)
+mimetype.desc.html=HTML-files (.html, .htm)
+mimetype.desc.xhtml=XHTML-files (.xhtml)
+mimetype.desc.txt=Textfiles (.txt)
+mimetype.desc.pdf=Adobe PDF-files (.pdf)
+mimetype.desc.bin=Binary files (.bin)
+save.hashdatainput.prefix=signaturedata
# Error Messages
-error.no.hashdata=Keine Signaturdaten verf\u00FCgbar: {0}
-error.display.hashdata=Signaturdaten konnten nicht dargestellt werden: {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}
-error.card.locked=B\u00FCrgerkarte ist gesperrt
-error.card.notactivated=B\u00FCrgerkartenfunktion ist nicht aktiviert
\ No newline at end of file
+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.pcsc=No PC/SC interface for smartcard access provided
+error.cardterminal=Could not find smartcard reader
+error.unknown=An error occured: {0}
+error.card.locked=Citizen-card is locked
+error.card.notactivated=Citizen-card not activated
\ No newline at end of file
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties
new file mode 100644
index 00000000..af0cb016
--- /dev/null
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_de.properties
@@ -0,0 +1,62 @@
+# Copyright 2008 Federal Chancellery Austria and
+# Graz University of Technology
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+title.welcome=Willkommen
+title.insertcard=Bitte B\u00FCrgerkarte in den Kartenleser stecken
+title.cardnotsupported=Die Karte wird nicht unterst\u00FCtzt
+title.cardpin={0} eingeben
+title.sign=Signatur erstellen
+title.error=Fehler
+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 die B\u00FCrgerkarte in den Kartenleser stecken
+message.enterpin={0} eingeben
+message.hashdatalink=Signaturdaten anzeigen
+message.hashdata=Signaturdaten:
+message.hashdatalist={0} Signaturdaten:
+message.retries=Noch {0} Versuch(e)
+message.overwrite=M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?
+label.pin={0}:
+label.pinsize=({0} stellig)
+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)
+save.hashdatainput.prefix=Signaturdaten
+
+# Error Messages
+error.no.hashdata=Keine Signaturdaten verf\u00FCgbar: {0}
+error.display.hashdata=Signaturdaten konnten nicht dargestellt werden: {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.
+
+
+
--
cgit v1.2.3
From 82c59c9d862d3ee9ad43fdc1509d0b5a61cc107c Mon Sep 17 00:00:00 2001
From: clemenso
Date: Tue, 11 Nov 2008 12:15:15 +0000
Subject: Frame HashData Display Interrupt in waitForAction (applet closed)
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@161 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../gv/egiz/bku/online/applet/AppletBKUWorker.java | 12 +-
.../bku/online/applet/AppletHashDataDisplay.java | 167 +++++++++++++
.../egiz/bku/online/applet/AppletHelpListener.java | 33 +--
.../at/gv/egiz/bku/online/applet/BKUApplet.java | 4 +-
.../bku/online/applet/BrowserHashDataDisplay.java | 52 +++++
.../applet/ExternalDisplaySignRequestHandler.java | 66 ------
.../bku/online/applet/JDialogHashDataDisplay.java | 221 ++++++++++++++++++
.../applet/WebServiceSignRequestHandler.java | 164 -------------
BKUApplet/src/main/resources/simplelog.properties | 2 +-
BKUApplet/src/test/resources/appletTest.html | 4 +-
.../src/main/java/at/gv/egiz/bku/gui/BKUGUI.java | 2 +-
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 5 +-
.../java/at/gv/egiz/bku/gui/HashDataViewer.java | 260 +++++++++++++++++++++
.../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 38 ++-
.../at/gv/egiz/bku/gui/Messages.properties | 2 +
.../at/gv/egiz/bku/gui/Messages_en.properties | 2 +
.../gv/egiz/bku/local/gui/LocalHelpListener.java | 1 -
.../bku/local/stal/LocalSignRequestHandler.java | 4 +-
BKUOnline/src/main/webapp/HTTP-ohne.html | 5 +-
BKUOnline/src/main/webapp/appletPage.jsp | 4 +-
20 files changed, 773 insertions(+), 275 deletions(-)
create 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/BrowserHashDataDisplay.java
delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java
create mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/JDialogHashDataDisplay.java
delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java
create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
(limited to 'BKUCommonGUI/src/main/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 cf842d55..8e88c012 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
@@ -31,6 +31,7 @@ import at.gv.egiz.stal.service.types.RequestType;
import at.gv.egiz.stal.service.types.ResponseType;
import at.gv.egiz.stal.util.STALTranslator;
import java.applet.AppletContext;
+import java.awt.Dimension;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
@@ -194,12 +195,15 @@ 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 WebServiceSignRequestHandler(stalPort, sessionId));
- } else {
- //if (HASHDATADISPLAY_EXTERNAL.equals(displayStyle)) {
+ addRequestHandler(SignRequest.class, new AppletHashDataDisplay(stalPort, sessionId));
+ } 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 ExternalDisplaySignRequestHandler(hashDataURL)); //
+ addRequestHandler(SignRequest.class, new BrowserHashDataDisplay(ctx, hashDataURL));
+ } 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));
}
}
}
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
new file mode 100644
index 00000000..b77485d9
--- /dev/null
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletHashDataDisplay.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package at.gv.egiz.bku.online.applet;
+
+import java.security.DigestException;
+import java.security.MessageDigest;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+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.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;
+
+/**
+ * A SignRequesthandler displaying hashdata inputs in the applet
+ * (only plaintext data is displayed, other hashdata inputs may be saved to disk).
+ *
+ * @author Clemens Orthacker
+ */
+public class AppletHashDataDisplay extends SignRequestHandler {
+
+ private static final Log log = LogFactory.getLog(AppletHashDataDisplay.class);
+ STALPortType stalPort;
+ 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;
+ }
+
+ @Override
+ public void displayHashDataInputs(List signedReferences) throws 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("Calling 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);
+ }
+ 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 + ")");
+ }
+
+ 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));
+ }
+
+ gui.showHashDataInputDialog(hashDataInputs, false, this, "ok");
+ }
+}
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
index 743dc7ef..5d199872 100644
--- 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
@@ -18,45 +18,28 @@
package at.gv.egiz.bku.online.applet;
import at.gv.egiz.bku.gui.AbstractHelpListener;
-import java.awt.Desktop;
+import java.applet.AppletContext;
import java.net.URL;
import java.util.Locale;
/**
- * Now uses java.awt.Desktop, which deprecates
- * the distinction between local and applet help listener
- * TODO: integrate in AbstractHelpListener
*
- * @deprecated
- * @author clemens
+ * @author Clemens Orthacker
*/
public class AppletHelpListener extends AbstractHelpListener {
-// protected AppletContext ctx;
- protected Desktop desktop;
+ protected AppletContext ctx;
- public AppletHelpListener(URL helpURL, Locale locale) {
+ public AppletHelpListener(AppletContext ctx, URL helpURL, Locale locale) {
super(helpURL, locale);
-// if (ctx == null) {
-// throw new RuntimeException("no applet context provided");
-// }
-// this.ctx = ctx;
- if (Desktop.isDesktopSupported()) {
- this.desktop = Desktop.getDesktop();
+ 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");
- if (desktop == null) {
- log.error("Failed to open default browser: Desktop API not available (libgnome installed?)");
- } else {
- if (!desktop.isSupported(Desktop.Action.BROWSE)) {
- log.error("Failed to open default browser: The system provides the Desktop API, but does not support the BROWSE action");
- } else {
- Desktop.getDesktop().browse(helpDocument.toURI());
- }
- }
+ 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 829cc79d..9d640dee 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
@@ -52,6 +52,8 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
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_BROWSER = "browser";
+ public static final String HASHDATA_DISPLAY_FRAME = "frame";
/**
* STAL WSDL namespace and service name
@@ -86,7 +88,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
AppletHelpListener helpListener = null;
try {
URL helpURL = getURLParameter(HELP_URL); //, getAppletParameter(SESSION_ID));
- helpListener = new AppletHelpListener(helpURL, getLocale()); //getAppletContext(),
+ helpListener = new AppletHelpListener(getAppletContext(), 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/BrowserHashDataDisplay.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BrowserHashDataDisplay.java
new file mode 100644
index 00000000..c30921da
--- /dev/null
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/BrowserHashDataDisplay.java
@@ -0,0 +1,52 @@
+/*
+ * 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.net.URL;
+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.signedinfo.ReferenceType;
+import java.applet.AppletContext;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class BrowserHashDataDisplay extends SignRequestHandler {
+
+ private static final Log log = LogFactory.getLog(BrowserHashDataDisplay.class);
+
+ protected AppletContext ctx;
+ protected URL hashDataURL;
+
+ public BrowserHashDataDisplay(AppletContext ctx, URL hashDataURL) {
+ this.ctx = ctx;
+ this.hashDataURL = hashDataURL;
+ }
+
+ @Override
+ public void displayHashDataInputs(List signedReferences) throws Exception {
+ //TODO pass reference Id's to servlet (TODO servlet)
+ log.debug("displaying hashdata inputs at " + hashDataURL);
+ ctx.showDocument(hashDataURL, "_blank");
+ }
+}
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
deleted file mode 100644
index e4567a6c..00000000
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/ExternalDisplaySignRequestHandler.java
+++ /dev/null
@@ -1,66 +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.net.URL;
-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.signedinfo.ReferenceType;
-import java.awt.Desktop;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class ExternalDisplaySignRequestHandler extends SignRequestHandler {
-
- private static final Log log = LogFactory.getLog(ExternalDisplaySignRequestHandler.class);
-
-// AppletContext ctx;
- protected URL hashDataURL;
- protected Desktop desktop;
-
- public ExternalDisplaySignRequestHandler(URL hashDataURL) {
-// this.ctx = ctx;
- this.hashDataURL = hashDataURL;
- if (Desktop.isDesktopSupported()) {
- desktop = Desktop.getDesktop();
- }
- }
-
- @Override
- public void displayHashDataInputs(List signedReferences) throws Exception {
- //TODO pass reference Id's to servlet (TODO servlet)
- log.debug("displaying hashdata inputs at " + hashDataURL);
-// ctx.showDocument(hashDataURL, "_blank");
- if (desktop == null) {
- log.error("Failed to open default browser: Desktop API not available (libgnome installed?)");
- } else {
- if (!desktop.isSupported(Desktop.Action.BROWSE)) {
- log.error("Failed to open default browser: The system provides the Desktop API, but does not support the BROWSE action");
- } else {
- Desktop.getDesktop().browse(hashDataURL.toURI());
- }
- }
- }
-
-}
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
new file mode 100644
index 00000000..1f0eda90
--- /dev/null
+++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/JDialogHashDataDisplay.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.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/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
deleted file mode 100644
index 014065f2..00000000
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/WebServiceSignRequestHandler.java
+++ /dev/null
@@ -1,164 +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.HashMap;
-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.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;
-
-/**
- * @author clemens
- */
-public class WebServiceSignRequestHandler extends SignRequestHandler {
-
- private static final Log log = LogFactory.getLog(WebServiceSignRequestHandler.class);
- STALPortType stalPort;
- String sessId;
-
- public WebServiceSignRequestHandler(STALPortType stalPort, String sessId) {
- if (stalPort == null || sessId == null) {
- throw new NullPointerException("STAL port must not be null");
- }
- this.sessId = sessId;
- this.stalPort = stalPort;
- }
-
- @Override
- public void displayHashDataInputs(List signedReferences) throws 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("Calling 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);
- }
- 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 + ")");
- }
-
- 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));
- }
-
- gui.showHashDataInputDialog(hashDataInputs, this, "ok");
- }
-}
diff --git a/BKUApplet/src/main/resources/simplelog.properties b/BKUApplet/src/main/resources/simplelog.properties
index d62508cf..51be76a8 100644
--- a/BKUApplet/src/main/resources/simplelog.properties
+++ b/BKUApplet/src/main/resources/simplelog.properties
@@ -15,7 +15,7 @@
# Logging detail level,
# Must be one of ("trace", "debug", "info", "warn", "error", or "fatal").
-org.apache.commons.logging.simplelog.defaultlog=debug
+org.apache.commons.logging.simplelog.defaultlog=trace
# Logs the Log instance used
org.apache.commons.logging.simplelog.showlogname=true
#Logs the class name with package(or Path)
diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html
index 5aec1998..1ba88e47 100644
--- a/BKUApplet/src/test/resources/appletTest.html
+++ b/BKUApplet/src/test/resources/appletTest.html
@@ -20,11 +20,11 @@
-
+
-
+
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 d96d22c8..d661c71a 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
@@ -814,7 +814,7 @@ public class BKUGUI implements BKUGUIFacade {
}
@Override
- public void showHashDataInputDialog(final List signedReferences, final ActionListener okListener, final String okCommand) {
+ public void showHashDataInputDialog(final List signedReferences, boolean standalone, 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 ad489c2e..38638b5d 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
@@ -57,6 +57,7 @@ public interface BKUGUIFacade {
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";
@@ -77,12 +78,14 @@ public interface BKUGUIFacade {
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";
@@ -116,7 +119,7 @@ public interface BKUGUIFacade {
public char[] getPin();
- public void showHashDataInputDialog(List signedReferences, ActionListener okListener, String actionCommand);
+ public void showHashDataInputDialog(List signedReferences, boolean standalone, ActionListener okListener, String actionCommand);
// public void showPlainTextHashDataInputDialog(String text, ActionListener saveListener, String saveCommand, ActionListener cancelListener, String cancelCommand);
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
new file mode 100644
index 00000000..3db06e19
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
@@ -0,0 +1,260 @@
+/*
+ * 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/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
index f2a8466b..583dae0f 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
@@ -882,14 +882,25 @@ public class SimpleGUI implements BKUGUIFacade {
}
@Override
- public void showHashDataInputDialog(final List signedReferences, final ActionListener okListener, final String okCommand) {
+ public void showHashDataInputDialog(final List signedReferences, boolean standalone, final ActionListener okListener, final String okCommand) {
if (signedReferences == null) {
showErrorDialog(messages.getString(ERR_NO_HASHDATA), new Object[] {"No SignedReferences provided"}, 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");
+
+ } else {
if ("text/plain".equals(signedReferences.get(0).getMimeType())) {
ActionListener saveHashDataListener = new ActionListener() {
@@ -910,7 +921,7 @@ public class SimpleGUI implements BKUGUIFacade {
} else {
showSaveHashDataInputDialog(signedReferences, okListener, okCommand);
}
-
+ }
} else {
final HashDataTableModel tableModel = new HashDataTableModel(signedReferences);
@@ -926,6 +937,27 @@ public class SimpleGUI implements BKUGUIFacade {
}
}
+ /**
+ * TODO
+ * @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");
+
+ HashDataViewer.showDialog(contentPane, signedReferences, messages, saveListener, saveCommand, helpListener);
+ }
+ });
+ }
+
private void showPlainTextHashDataInputDialog(final String hashDataText, final ActionListener saveListener, final String saveCommand, final ActionListener cancelListener, final String cancelCommand) {
log.debug("scheduling plaintext hashdatainput dialog");
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 2dc03491..c47242b2 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,6 +25,7 @@ title.hashdata=Signaturdaten
windowtitle.save=Signaturdaten speichern
windowtitle.savedir=Signaturdaten in Verzeichnis speichern
windowtitle.overwrite=Datei \u00FCberschreiben?
+windowtitle.viewer=Signaturedaten
message.wait=Bitte warten...
message.insertcard=Bitte die B\u00FCrgerkarte in den Kartenleser stecken
message.enterpin={0} eingeben
@@ -40,6 +41,7 @@ button.cancel=Abbrechen
button.back=Zur\u00FCck
button.sign=Signieren
button.save=Speichern...
+button.close=Schlie\u00DFen
mimetype.desc.xml=XML-Dateien (.xml)
mimetype.desc.html=HTML-Dateien (.html, .htm)
mimetype.desc.xhtml=XHTML-Dateien (.xhtml)
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 3b8ac1bc..c7cc9084 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
@@ -25,6 +25,7 @@ title.hashdata=Signature data
windowtitle.save=Save signature data
windowtitle.savedir=Save signature data to directory
windowtitle.overwrite=Overwrite file?
+windowtitle.viewer=Signature data
message.wait=Please wait...
message.insertcard=Please insert your citizen-card into the reader
message.enterpin=Enter {0}
@@ -40,6 +41,7 @@ button.cancel=Cancel
button.back=Back
button.sign=Sign
button.save=Save...
+button.close=Close
mimetype.desc.xml=XML-files (.xml)
mimetype.desc.html=HTML-files (.html, .htm)
mimetype.desc.xhtml=XHTML-files (.xhtml)
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
index 2251a474..e32c9c3d 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
@@ -25,7 +25,6 @@ import java.util.Locale;
/**
*
- * @deprecated see AppletHelpListener
* @author Clemens Orthacker
*/
public class LocalHelpListener extends AbstractHelpListener {
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 19a56502..19e6a657 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
@@ -53,7 +53,7 @@ public class LocalSignRequestHandler extends SignRequestHandler {
*/
@SuppressWarnings("unchecked")
@Override
- public STALResponse handleRequest(STALRequest request) {
+ public STALResponse handleRequest(STALRequest request) throws InterruptedException {
if (request instanceof SignRequest) {
SignRequest signReq = (SignRequest) request;
hashDataInputs = signReq.getHashDataInput();
@@ -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, this, "ok");
+ gui.showHashDataInputDialog(selectedHashDataInputs, false, this, "ok");
}
private ByteArrayHashDataInput getByteArrayHashDataInput(HashDataInput hashDataInput) throws IOException {
diff --git a/BKUOnline/src/main/webapp/HTTP-ohne.html b/BKUOnline/src/main/webapp/HTTP-ohne.html
index 47c059f2..112a1d92 100644
--- a/BKUOnline/src/main/webapp/HTTP-ohne.html
+++ b/BKUOnline/src/main/webapp/HTTP-ohne.html
@@ -99,8 +99,9 @@ legend {
- external
- internal
+ Frame
+ Browser
+ Applet
\ 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 547d2ac46ea1feb323fd945de690b8ee0ca9c5f3 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Thu, 13 Nov 2008 18:33:03 +0000
Subject: FRAME HashDataDisplay FRAME Help
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@167 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerDialog.java | 3 +++
1 file changed, 3 insertions(+)
(limited to 'BKUCommonGUI/src/main/java')
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
index cd04ad98..e643c876 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerDialog.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerDialog.java
@@ -151,6 +151,9 @@ public class ViewerDialog extends JDialog
InputStream content = hashData.getHashDataInput();
String mimeType = hashData.getMimeType();
String encoding = hashData.getEncoding();
+ if (encoding == null) {
+ encoding = "UTF-8";
+ }
JPanel hashDataPanel = createViewerPanel(messages.getString(BKUGUIFacade.MESSAGE_HASHDATA), content, mimeType, encoding, helpListener);
JPanel buttonPanel = createButtonPanel(saveListener, saveCommand);
--
cgit v1.2.3
From fef61ddc786960015c6fc416d4ad2d5d0f2048d1 Mon Sep 17 00:00:00 2001
From: clemenso
Date: Thu, 13 Nov 2008 20:56:23 +0000
Subject: bugfix openwindow blocked bugfix helpTopic always hashdataviewer
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@168 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../at/gv/egiz/bku/online/applet/BKUApplet.java | 2 +-
.../bku/online/applet/DefaultHelpListener.java | 38 +--
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 1 +
.../java/at/gv/egiz/bku/gui/HashDataViewer.java | 288 +++++++++++++++++
.../java/at/gv/egiz/bku/gui/HelpMouseListener.java | 10 +-
.../main/java/at/gv/egiz/bku/gui/HelpViewer.java | 211 ++++++++++++
.../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 3 +-
.../main/java/at/gv/egiz/bku/gui/ViewerDialog.java | 357 ---------------------
.../at/gv/egiz/bku/gui/Messages.properties | 1 +
.../at/gv/egiz/bku/gui/Messages_en.properties | 1 +
.../gv/egiz/bku/local/gui/LocalHelpListener.java | 2 +-
.../at/gv/egiz/bku/local/stal/BKUGuiProxy.java | 18 +-
12 files changed, 531 insertions(+), 401 deletions(-)
create 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/HelpViewer.java
delete mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerDialog.java
(limited to 'BKUCommonGUI/src/main/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 b4407b22..4b49c5d5 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
@@ -90,7 +90,7 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
try {
URL helpURL = getURLParameter(HELP_URL); //, getAppletParameter(SESSION_ID));
// helpListener = new BrowserHelpListener(getAppletContext(), helpURL, getLocale());
- helpListener = new DefaultHelpListener(helpURL, getLocale());
+ helpListener = new DefaultHelpListener(getAppletContext(), 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/DefaultHelpListener.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/DefaultHelpListener.java
index 9876ef7e..6eec5665 100644
--- 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
@@ -16,49 +16,28 @@
*/
package at.gv.egiz.bku.online.applet;
+import at.gv.egiz.bku.gui.HelpViewer;
import at.gv.egiz.bku.gui.AbstractHelpListener;
-import at.gv.egiz.bku.gui.ViewerDialog;
-import java.io.InputStream;
+import java.applet.AppletContext;
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) {
+ protected AppletContext ctx;
+
+ public DefaultHelpListener(AppletContext ctx, URL helpURL, Locale locale) {
super(helpURL, locale);
+ this.ctx = ctx;
}
@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();
-
+ public void showDocument(final URL helpURL, final String helpTopic) throws Exception {
log.debug("schedule help dialog");
SwingUtilities.invokeLater(new Runnable() {
@@ -68,10 +47,9 @@ public class DefaultHelpListener extends AbstractHelpListener {
log.debug("show help dialog");
- ViewerDialog.showHelp(null, helpTopic, content, mimeType, messages);
+ HelpViewer.showHelpDialog(ctx, helpURL, helpTopic, messages);
}
});
-// gui.showHelpDialog(helpDocument.getStream(), mimetype, encoding);
}
}
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 2daf3300..c7032f90 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
@@ -38,6 +38,7 @@ public interface BKUGUIFacade {
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 ERR_EXTERNAL_LINK = "error.external.link";
public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages";
public static final String DEFAULT_BACKGROUND = "/images/BackgroundChipperling.png";
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
new file mode 100644
index 00000000..8883098a
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
@@ -0,0 +1,288 @@
+/*
+ * 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.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+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 org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class HashDataViewer extends JDialog
+ implements ActionListener {
+
+ public static final String PLAINTEXT_FONT = "Monospaced";
+ protected static final Log log = LogFactory.getLog(HashDataViewer.class);
+
+ private static HashDataViewer dialog;
+
+ protected ResourceBundle messages;
+
+ /**
+ *
+ * @param signedReferences currently, only one hashdata input (the first in the list) is displayed
+ */
+ public static void showHashDataInput(List hashDataInputs,
+ ResourceBundle messages,
+ ActionListener saveListener,
+ String saveCommand,
+ ActionListener helpListener) {
+ showHashDataInput(null, hashDataInputs, messages, saveListener, saveCommand, helpListener);
+ }
+
+ /**
+ *
+ * @param frameComp owner
+ */
+ public static void showHashDataInput(Component frameComp,
+ List hashDataInputs,
+ ResourceBundle messages,
+ ActionListener saveListener,
+ String saveCommand,
+ ActionListener helpListener) {
+
+ Frame frame = null;
+ if (frameComp != null) {
+ JOptionPane.getFrameForComponent(frameComp);
+ }
+ dialog = new HashDataViewer(frame,
+ messages,
+ hashDataInputs,
+ saveListener,
+ saveCommand,
+ helpListener);
+ dialog.setVisible(true);
+ }
+
+ private HashDataViewer(Frame frame,
+ ResourceBundle messages,
+ List hashDataInputs,
+ ActionListener saveListener,
+ String saveCommand,
+ ActionListener 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);
+
+ JPanel hashDataPanel = createViewerPanel(
+ messages.getString(BKUGUIFacade.MESSAGE_HASHDATA),
+ content,
+ hashData.getMimeType(),
+ helpListener);
+ JPanel buttonPanel = createButtonPanel(saveListener, saveCommand);
+ initContentPane(new Dimension(600, 400), hashDataPanel, 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,
+ 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";
+ }
+
+ 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 {
+ 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();
+ helpLabel.setIcon(new ImageIcon(getClass().getResource(BKUGUIFacade.HELP_IMG)));
+ helpLabel.addMouseListener(new MouseAdapter() {
+
+ @Override
+ public void mouseClicked(MouseEvent arg0) {
+ ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, BKUGUIFacade.HELP_HASHDATAVIEWER);
+ helpListener.actionPerformed(e);
+ }
+ });
+ 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(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) {
+ HashDataViewer.dialog.setVisible(false);
+ }
+}
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 531884d1..b7bbe971 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
@@ -28,23 +28,27 @@ public class HelpMouseListener extends MouseAdapter {
protected static final Log log = LogFactory.getLog(HelpMouseListener.class);
- protected ActionListener externalHelpListener;
+ protected ActionListener helpListener;
protected String locale;
protected String topic;
public HelpMouseListener(ActionListener externalHelpListener) {
super();
- this.externalHelpListener = externalHelpListener;
+ this.helpListener = externalHelpListener;
}
public void setHelpTopic(String topic) {
log.trace("setting help topic: " + topic);
this.topic = topic;
}
+
+ public ActionListener getActionListener() {
+ return helpListener;
+ }
@Override
public void mouseClicked(MouseEvent arg0) {
ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, topic);
- externalHelpListener.actionPerformed(e);
+ helpListener.actionPerformed(e);
}
}
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
new file mode 100644
index 00000000..42ca2090
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HelpViewer.java
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package at.gv.egiz.bku.gui;
+
+import at.gv.egiz.bku.gui.*;
+import java.applet.AppletContext;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.IOException;
+import java.net.URL;
+import java.text.MessageFormat;
+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.SwingUtilities;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class HelpViewer extends JDialog
+ implements ActionListener {
+
+ protected static final Log log = LogFactory.getLog(HelpViewer.class);
+ private static HelpViewer dialog;
+ protected ResourceBundle messages;
+ protected AppletContext ctx;
+
+ /**
+ *
+ * @param ctx external links are opened via ctx.showDocument()
+ * @param helpURL
+ * @param helpTopic
+ * @param messages
+ */
+ public static void showHelpDialog(AppletContext ctx,
+ URL helpURL,
+ String helpTopic,
+ ResourceBundle messages) {
+ showHelpDialog(null, ctx, helpURL, helpTopic, messages);
+ }
+
+ public static void showHelpDialog(URL helpURL,
+ String helpTopic,
+ ResourceBundle messages) {
+ showHelpDialog(null, null, helpURL, helpTopic, messages);
+ }
+
+ public static void showHelpDialog(Component owner,
+ AppletContext ctx,
+ URL helpURL,
+ String helpTopic,
+ ResourceBundle messages) {
+
+ Frame frame = null;
+ if (owner != null) {
+ JOptionPane.getFrameForComponent(owner);
+ }
+ dialog = new HelpViewer(frame, messages, ctx, helpURL, helpTopic);
+ dialog.setVisible(true);
+ }
+
+ private HelpViewer(Frame frame,
+ ResourceBundle messages,
+ AppletContext ctx,
+ URL helpURL,
+ String helpTopic) {
+ super(frame, messages.getString(BKUGUIFacade.WINDOWTITLE_HELP), true);
+ this.messages = messages;
+ this.ctx = ctx;
+
+ String p = messages.getString(BKUGUIFacade.MESSAGE_HELP);
+ String helpItem = messages.getString(helpTopic);
+ String viewerLabel = MessageFormat.format(p, new Object[]{helpItem});
+
+ JPanel helpPanel = createViewerPanel(viewerLabel, helpURL);
+ 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());
+ }
+
+ private JPanel createViewerPanel(String viewerLabelText, URL helpURL) {
+ log.debug("viewer dialog: " + helpURL.toString());
+
+ final JEditorPane viewer = new JEditorPane();
+ viewer.setEditable(false);
+ try {
+ viewer.setPage(helpURL);
+ viewer.addHyperlinkListener(new HyperlinkListener() {
+
+ @Override
+ public void hyperlinkUpdate(HyperlinkEvent e) {
+ final URL url = e.getURL();
+ if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+ if (ctx != null) {
+ log.debug("open external link in help viewer: " + url);
+ ctx.showDocument(url, "_blank");
+ } else {
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+ String msgP = messages.getString(BKUGUIFacade.ERR_EXTERNAL_LINK);
+ String msg = MessageFormat.format(msgP, url);
+ String title = messages.getString(BKUGUIFacade.TITLE_ERROR);
+ JOptionPane.showMessageDialog(rootPane, msg, title, JOptionPane.ERROR_MESSAGE);
+ }
+ });
+ }
+ }
+ }
+ });
+ } catch (IOException ex) {
+ String p = messages.getString(BKUGUIFacade.ERR_VIEWER);
+ viewer.setText(MessageFormat.format(p, new Object[]{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);
+
+ 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;
+ }
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ HelpViewer.dialog.setVisible(false);
+ }
+}
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 6250dd0e..a810d34c 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
@@ -954,7 +954,8 @@ public class SimpleGUI implements BKUGUIFacade {
log.debug("show plaintext hashdatainput dialog");
- ViewerDialog.showHashDataInput(contentPane, signedReferences, messages, saveListener, saveCommand, helpListener);
+ ActionListener l = helpListener.getActionListener();
+ HashDataViewer.showHashDataInput(contentPane, signedReferences, messages, saveListener, saveCommand, l);
}
});
}
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
deleted file mode 100644
index e643c876..00000000
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ViewerDialog.java
+++ /dev/null
@@ -1,357 +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.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();
- if (encoding == null) {
- encoding = "UTF-8";
- }
-
- 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 ba20471d..6c049c85 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
@@ -67,6 +67,7 @@ error.test=Fehler1 {0} - Fehler2 {1}
error.card.locked=B\u00FCrgerkarte ist gesperrt
error.card.notactivated=B\u00FCrgerkartenfunktion ist nicht aktiviert
error.viewer=Der Inhalt kann nicht dargestellt werden: {0}
+error.external.link=Externer Link {0} wird nicht ge\u00F6ffnet
# Help Topics
help.welcome=Startseite
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 edc5371d..80dc4234 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
@@ -65,6 +65,7 @@ error.test=Error1 {0} - Error2 {1}
error.card.locked=Citizen-card is locked
error.card.notactivated=Citizen-card not activated
error.viewer=Failed to display contents: {0}
+error.external.link=Externer Link {0} wird nicht ge\u00F6ffnet
# Help Topics
help.welcome=Welcome page
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
index e32c9c3d..d551ae0d 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/gui/LocalHelpListener.java
@@ -39,7 +39,7 @@ public class LocalHelpListener extends AbstractHelpListener {
}
@Override
- public void showDocument(URL helpDocument) throws IOException, URISyntaxException {
+ public void showDocument(URL helpDocument, String helpTopic) throws IOException, URISyntaxException {
if (desktop == null) {
log.error("Failed to open default browser: Desktop API not available (libgnome installed?)");
} else {
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 39e997b7..fb8f2432 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
@@ -84,14 +84,6 @@ public class BKUGuiProxy implements BKUGUIFacade {
delegate.showErrorDialog(errorMsgKey, errorMsgParams);
}
- @Override
- public void showHashDataInputDialog(List signedReferences,
- ActionListener okListener, String actionCommand) {
- showDialog();
- delegate.showHashDataInputDialog(signedReferences, okListener,
- actionCommand);
- }
-
@Override
public void showInsertCardDialog(ActionListener cancelListener,
String actionCommand) {
@@ -131,4 +123,14 @@ public class BKUGuiProxy implements BKUGUIFacade {
showDialog();
delegate.showWelcomeDialog();
}
+
+ @Override
+ public void showHashDataInputDialog(List signedReferences,
+ boolean externalDisplay,
+ ActionListener okListener,
+ String okCommand) {
+ showDialog();
+ delegate.showHashDataInputDialog(signedReferences, externalDisplay, okListener,
+ okCommand);
+ }
}
--
cgit v1.2.3
From f09efb78459c7cd49ca4e28d92f170833e7ee32d Mon Sep 17 00:00:00 2001
From: clemenso
Date: Fri, 14 Nov 2008 16:30:28 +0000
Subject: git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@172
8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
---
.../gv/egiz/bku/online/applet/AppletBKUWorker.java | 1 -
.../at/gv/egiz/bku/online/applet/BKUApplet.java | 5 +-
.../bku/online/applet/DefaultHelpListener.java | 55 --------------
BKUApplet/src/test/resources/appletTest.html | 4 +-
.../main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java | 1 +
.../at/gv/egiz/bku/gui/DefaultHelpListener.java | 62 ++++++++++++++++
.../java/at/gv/egiz/bku/gui/HashDataViewer.java | 15 +++-
.../main/java/at/gv/egiz/bku/gui/HelpViewer.java | 5 +-
.../main/java/at/gv/egiz/bku/gui/ImagePanel.java | 4 +-
.../main/java/at/gv/egiz/bku/gui/SimpleGUI.java | 6 ++
.../egiz/bku/gui/html/RestrictedHTMLEditorKit.java | 49 +++++++++++++
.../gv/egiz/bku/gui/html/RestrictedImageView.java | 67 +++++++++++++++++
.../at/gv/egiz/bku/gui/Messages.properties | 4 +-
.../at/gv/egiz/bku/gui/Messages_en.properties | 3 +-
BKUCommonGUI/src/main/resources/images/help.png | Bin 303 -> 441 bytes
.../src/main/resources/images/help_orig.png | Bin 0 -> 303 bytes
.../at/gv/egiz/bku/local/stal/SMCCSTALFactory.java | 7 +-
BKULocal/src/main/webapp/WEB-INF/web.xml | 40 ++++++----
BKULocal/src/main/webapp/help.jsp | 29 ++++++++
.../webapp/helpfiles/de/error.card.locked.html | 46 ++++++++++++
.../main/webapp/helpfiles/de/error.card.locked.png | Bin 0 -> 1325 bytes
.../helpfiles/de/error.card.notactivated.html | 43 +++++++++++
.../helpfiles/de/error.card.notactivated.png | Bin 0 -> 1419 bytes
.../webapp/helpfiles/de/error.cardterminal.html | 42 +++++++++++
.../webapp/helpfiles/de/error.cardterminal.png | Bin 0 -> 1490 bytes
.../src/main/webapp/helpfiles/de/error.pcsc.html | 40 ++++++++++
.../src/main/webapp/helpfiles/de/error.pcsc.png | Bin 0 -> 3684 bytes
.../webapp/helpfiles/de/error.ws.unreachable.html | 39 ++++++++++
.../webapp/helpfiles/de/error.ws.unreachable.png | Bin 0 -> 2561 bytes
.../webapp/helpfiles/de/help.cardnotsupported.html | 47 ++++++++++++
.../webapp/helpfiles/de/help.cardnotsupported.png | Bin 0 -> 1113 bytes
.../src/main/webapp/helpfiles/de/help.cardpin.html | 41 +++++++++++
.../src/main/webapp/helpfiles/de/help.cardpin1.png | Bin 0 -> 1334 bytes
.../src/main/webapp/helpfiles/de/help.cardpin2.png | Bin 0 -> 1324 bytes
.../webapp/helpfiles/de/help.hashdataviewer.html | 39 ++++++++++
.../webapp/helpfiles/de/help.hashdataviewer.png | Bin 0 -> 11310 bytes
.../main/webapp/helpfiles/de/help.insertcard.html | 42 +++++++++++
.../main/webapp/helpfiles/de/help.insertcard.png | Bin 0 -> 1207 bytes
.../src/main/webapp/helpfiles/de/help.retry.html | 40 ++++++++++
.../src/main/webapp/helpfiles/de/help.retry.png | Bin 0 -> 1711 bytes
.../main/webapp/helpfiles/de/help.signpin-1.png | Bin 0 -> 12818 bytes
.../src/main/webapp/helpfiles/de/help.signpin.html | 45 ++++++++++++
.../src/main/webapp/helpfiles/de/help.signpin.png | Bin 0 -> 1511 bytes
.../src/main/webapp/helpfiles/de/help.wait.html | 39 ++++++++++
.../src/main/webapp/helpfiles/de/help.wait.png | Bin 0 -> 981 bytes
.../src/main/webapp/helpfiles/de/help.welcome.html | 40 ++++++++++
.../src/main/webapp/helpfiles/de/help.welcome.png | Bin 0 -> 2152 bytes
BKULocal/src/main/webapp/helpfiles/help.css | 81 +++++++++++++++++++++
BKULocal/src/main/webapp/helpfiles/index.html | 17 +++++
.../src/main/webapp/img/BackgroundChipperling.png | Bin 0 -> 2041 bytes
BKUOnline/src/main/webapp/img/BackgroundMocca.png | Bin 0 -> 1287 bytes
51 files changed, 910 insertions(+), 88 deletions(-)
delete mode 100644 BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/DefaultHelpListener.java
create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java
create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedHTMLEditorKit.java
create mode 100644 BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedImageView.java
create mode 100644 BKUCommonGUI/src/main/resources/images/help_orig.png
create mode 100644 BKULocal/src/main/webapp/help.jsp
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.card.locked.html
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.card.locked.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.card.notactivated.html
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.card.notactivated.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.html
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.pcsc.html
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.pcsc.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.html
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.html
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.cardpin.html
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.cardpin1.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.cardpin2.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.html
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.insertcard.html
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.insertcard.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.retry.html
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.retry.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.signpin-1.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.signpin.html
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.signpin.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.wait.html
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.wait.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.welcome.html
create mode 100644 BKULocal/src/main/webapp/helpfiles/de/help.welcome.png
create mode 100644 BKULocal/src/main/webapp/helpfiles/help.css
create mode 100644 BKULocal/src/main/webapp/helpfiles/index.html
create mode 100644 BKUOnline/src/main/webapp/img/BackgroundChipperling.png
create mode 100644 BKUOnline/src/main/webapp/img/BackgroundMocca.png
(limited to 'BKUCommonGUI/src/main/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 db88c037..f862360b 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
@@ -31,7 +31,6 @@ import at.gv.egiz.stal.service.types.RequestType;
import at.gv.egiz.stal.service.types.ResponseType;
import at.gv.egiz.stal.util.STALTranslator;
import java.applet.AppletContext;
-import java.awt.Dimension;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
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 4b49c5d5..7963768e 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.DefaultHelpListener;
import at.gv.egiz.bku.gui.AbstractHelpListener;
import java.net.MalformedURLException;
import java.net.URL;
@@ -92,12 +93,12 @@ public class BKUApplet extends JApplet implements AppletParameterProvider {
// helpListener = new BrowserHelpListener(getAppletContext(), helpURL, getLocale());
helpListener = new DefaultHelpListener(getAppletContext(), helpURL, getLocale());
} catch (MalformedURLException ex) {
- log.warn("failed to load help URL, disabling help: " + ex.getMessage());
+ log.warn("failed to load help URL: " + ex.getMessage() + ", disabling help");
}
try {
backgroundImgURL = getURLParameter(BACKGROUND_PARAM);
} catch (MalformedURLException ex) {
- log.info("failed to load applet background image, using default: " + ex.getMessage());
+ log.warn("failed to load applet background image: " + ex.getMessage() + ", using default");
}
if (locale != null) {
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
deleted file mode 100644
index 6eec5665..00000000
--- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/DefaultHelpListener.java
+++ /dev/null
@@ -1,55 +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.HelpViewer;
-import at.gv.egiz.bku.gui.AbstractHelpListener;
-import java.applet.AppletContext;
-import java.net.URL;
-import java.util.Locale;
-import javax.swing.SwingUtilities;
-
-/**
- *
- * @author Clemens Orthacker
- */
-public class DefaultHelpListener extends AbstractHelpListener {
-
- protected AppletContext ctx;
-
- public DefaultHelpListener(AppletContext ctx, URL helpURL, Locale locale) {
- super(helpURL, locale);
- this.ctx = ctx;
- }
-
- @Override
- public void showDocument(final URL helpURL, final String helpTopic) throws Exception {
- log.debug("schedule help dialog");
-
- SwingUtilities.invokeLater(new Runnable() {
-
- @Override
- public void run() {
-
- log.debug("show help dialog");
-
- HelpViewer.showHelpDialog(ctx, helpURL, helpTopic, messages);
-
- }
- });
- }
-}
diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html
index 1ba88e47..eaf6376d 100644
--- a/BKUApplet/src/test/resources/appletTest.html
+++ b/BKUApplet/src/test/resources/appletTest.html
@@ -21,9 +21,9 @@
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/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index c7032f90..87982c79 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
@@ -89,6 +89,7 @@ public interface BKUGUIFacade {
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 static final String ALT_HELP = "alt.help";
public void init(Container contentPane, Locale locale, URL background, ActionListener 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
new file mode 100644
index 00000000..ba968a48
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/DefaultHelpListener.java
@@ -0,0 +1,62 @@
+/*
+ * 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.applet.AppletContext;
+import java.net.URL;
+import java.util.Locale;
+import javax.swing.SwingUtilities;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class DefaultHelpListener extends AbstractHelpListener {
+
+ protected AppletContext ctx;
+
+ public DefaultHelpListener(AppletContext ctx, URL helpURL, Locale locale) {
+ super(helpURL, locale);
+ this.ctx = ctx;
+ }
+
+ public DefaultHelpListener(URL helpURL, Locale locale) {
+ super(helpURL, locale);
+ this.ctx = null;
+ }
+
+ @Override
+ public void showDocument(final URL helpURL, final String helpTopic) throws Exception {
+ log.debug("schedule help dialog");
+
+ 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);
+ }
+ }
+ });
+ }
+}
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 8883098a..31887bde 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;
@@ -23,6 +24,7 @@ import java.awt.Cursor;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
+import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
@@ -47,6 +49,11 @@ 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;
@@ -184,11 +191,14 @@ public class HashDataViewer extends JDialog
}
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()));
+// } else if ("text/html".equals(mimeType)) {
+// viewer.setEditorKitForContentType("text/html", new RestrictedHTMLEditorKit());
}
+ viewer.setEditable(false);
+ viewer.setContentType(mimeType);
EditorKit editorKit = viewer.getEditorKit();
Document document = editorKit.createDefaultDocument();
@@ -220,6 +230,7 @@ public class HashDataViewer extends JDialog
if (helpListener != null) {
JLabel helpLabel = new JLabel();
helpLabel.setIcon(new ImageIcon(getClass().getResource(BKUGUIFacade.HELP_IMG)));
+ helpLabel.getAccessibleContext().setAccessibleName(messages.getString(BKUGUIFacade.ALT_HELP));
helpLabel.addMouseListener(new MouseAdapter() {
@Override
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 42ca2090..173254e7 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
@@ -16,7 +16,6 @@
*/
package at.gv.egiz.bku.gui;
-import at.gv.egiz.bku.gui.*;
import java.applet.AppletContext;
import java.awt.Component;
import java.awt.Container;
@@ -30,7 +29,6 @@ import java.net.URL;
import java.text.MessageFormat;
import java.util.ResourceBundle;
import javax.swing.GroupLayout;
-import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
@@ -136,6 +134,7 @@ public class HelpViewer extends JDialog
final JEditorPane viewer = new JEditorPane();
viewer.setEditable(false);
try {
+ viewer.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
viewer.setPage(helpURL);
viewer.addHyperlinkListener(new HyperlinkListener() {
@@ -165,7 +164,7 @@ public class HelpViewer extends JDialog
String p = messages.getString(BKUGUIFacade.ERR_VIEWER);
viewer.setText(MessageFormat.format(p, new Object[]{ex.getMessage()}));
}
-
+ viewer.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
JScrollPane scrollPane = new JScrollPane(viewer);
scrollPane.setPreferredSize(viewer.getPreferredSize());
scrollPane.setAlignmentX(LEFT_ALIGNMENT);
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 1185cf53..271c0b65 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
@@ -24,8 +24,8 @@ import javax.swing.ImageIcon;
import javax.swing.JPanel;
/**
- *
- * @author clemens
+ *
+ * @author Clemens Orthacker
*/
public class ImagePanel extends JPanel {
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 a810d34c..bb568b75 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
@@ -158,6 +158,11 @@ public class SimpleGUI implements BKUGUIFacade {
if (background == null) {
background = this.getClass().getResource(DEFAULT_BACKGROUND);
}
+ if ("file".equals(background.getProtocol())) {
+ log.warn("local background image not allowed: " + background);
+ background = this.getClass().getResource(DEFAULT_BACKGROUND);
+ }
+ log.debug("loading background " + background);
contentPanel = new ImagePanel(background);
// contentPanel.setBorder(new TitledBorder("content"));
@@ -179,6 +184,7 @@ public class SimpleGUI implements BKUGUIFacade {
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));
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedHTMLEditorKit.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedHTMLEditorKit.java
new file mode 100644
index 00000000..680bf1a4
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedHTMLEditorKit.java
@@ -0,0 +1,49 @@
+/*
+ * 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.html;
+
+import javax.swing.text.Element;
+import javax.swing.text.StyleConstants;
+import javax.swing.text.View;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.HTMLEditorKit;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class RestrictedHTMLEditorKit extends HTMLEditorKit {
+
+
+ public static class RestrictedHTMLFactory extends HTMLFactory {
+
+ @Override
+ public View create(Element elem) {
+ Object o =
+ elem.getAttributes().getAttribute(StyleConstants.NameAttribute);
+ if (o instanceof HTML.Tag) {
+ HTML.Tag kind = (HTML.Tag) o;
+ if (kind == HTML.Tag.IMG)
+ return new RestrictedImageView(elem);
+ }
+ return super.create( elem );
+ }
+
+ }
+
+}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedImageView.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedImageView.java
new file mode 100644
index 00000000..b1aa35db
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/html/RestrictedImageView.java
@@ -0,0 +1,67 @@
+/*
+ * 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.html;
+
+import javax.swing.text.Element;
+import javax.swing.text.html.HTML;
+import javax.swing.text.html.ImageView;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+/**
+ * ImageViewer.refreshImage() (and loadImage()) is private :-(
+ */
+ public class RestrictedImageView extends ImageView {
+
+ public RestrictedImageView(Element elem) {
+ super(elem);
+ }
+
+// @Override
+// public Image getImage() {
+// int s = state;
+// if ((s & RELOAD_IMAGE_FLAG) != 0) {
+// refreshImage();
+// }
+// s = state;
+// if ((s & RELOAD_FLAG) != 0) {
+// synchronized(this) {
+// state = (state | RELOAD_FLAG) ^ RELOAD_FLAG;
+// }
+// setPropertiesFromAttributes();
+// }
+// return super.getImage();
+// }
+
+ /**
+ * check whether this URL corresponds to the data URI scheme
+ * (and the referenced content is directly included in the document).
+ * @return
+ */
+ private boolean isDataURI() {
+ String src = (String)getElement().getAttributes().
+ getAttribute(HTML.Attribute.SRC);
+ if (src == null) {
+ return false;
+ }
+
+ return src.toLowerCase().startsWith("data");
+ }
+ }
\ 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 6c049c85..5f62c05a 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
@@ -31,7 +31,8 @@ message.wait=Bitte warten...
message.insertcard=Bitte die B\u00FCrgerkarte in den Kartenleser stecken
message.enterpin={0} eingeben
message.hashdatalink=Signaturdaten anzeigen
-message.hashdata=Dies ist eine Voransicht des zu signierenden Inhaltes. F\u00FCr Details siehe Hilfe.
+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)
@@ -52,6 +53,7 @@ mimetype.desc.txt=Textdateien (.txt)
mimetype.desc.pdf=Adobe PDF-Dateien (.pdf)
mimetype.desc.bin=Bin\u00E4rdateien (.bin)
save.hashdatainput.prefix=Signaturdaten
+alt.help=Hilfe
# Error Messages
error.no.hashdata=Keine Signaturdaten verf\u00FCgbar: {0}
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 80dc4234..d963fd5f 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
@@ -31,7 +31,7 @@ message.wait=Please wait...
message.insertcard=Please insert your citizen-card into the reader
message.enterpin=Enter {0}
message.hashdatalink=Display signature data
-message.hashdata=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={0} tries left
message.overwrite=Overwrite {0}?
@@ -51,6 +51,7 @@ mimetype.desc.txt=Textfiles (.txt)
mimetype.desc.pdf=Adobe PDF-files (.pdf)
mimetype.desc.bin=Binary files (.bin)
save.hashdatainput.prefix=signaturedata
+alt.help=help
# Error Messages
error.no.hashdata=No signature data available: {0}
diff --git a/BKUCommonGUI/src/main/resources/images/help.png b/BKUCommonGUI/src/main/resources/images/help.png
index 5d6da3bf..d1c36c33 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/main/resources/images/help_orig.png b/BKUCommonGUI/src/main/resources/images/help_orig.png
new file mode 100644
index 00000000..5d6da3bf
Binary files /dev/null and b/BKUCommonGUI/src/main/resources/images/help_orig.png differ
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 ad7b9646..cad8cfb6 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
@@ -27,7 +27,7 @@ import javax.swing.WindowConstants;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.gui.BKUGUIFactory;
-import at.gv.egiz.bku.local.gui.LocalHelpListener;
+import at.gv.egiz.bku.gui.DefaultHelpListener;
import at.gv.egiz.stal.STAL;
import at.gv.egiz.stal.STALFactory;
import java.net.URL;
@@ -49,10 +49,11 @@ public class SMCCSTALFactory implements STALFactory {
dialog.setLocale(locale);
}
BKUGUIFacade gui = BKUGUIFactory.createGUI(BKUGUIFactory.ADVANCED_GUI);
- LocalHelpListener helpListener = null;
+ DefaultHelpListener helpListener = null;
try {
if (helpURL != null) {
- helpListener = new LocalHelpListener(new URL(helpURL), dialog.getLocale());
+// helpListener = new LocalHelpListener(new URL(helpURL), dialog.getLocale());
+ helpListener = new DefaultHelpListener(new URL(helpURL), locale);
} else {
log.warn("no HELP URL configured, help system disabled");
}
diff --git a/BKULocal/src/main/webapp/WEB-INF/web.xml b/BKULocal/src/main/webapp/WEB-INF/web.xml
index 64f9a581..36087d17 100644
--- a/BKULocal/src/main/webapp/WEB-INF/web.xml
+++ b/BKULocal/src/main/webapp/WEB-INF/web.xml
@@ -1,20 +1,20 @@
-
+
http-security-layer-request
@@ -36,6 +36,10 @@
BKUServletat.gv.egiz.bku.local.webapp.SpringBKUServlet
+
+ help
+ /help.jsp
+ BKUServlet/http-security-layer-request
@@ -44,6 +48,10 @@
BKUServlet/https-security-layer-request
+
+ help
+ /help/*
+
diff --git a/BKULocal/src/main/webapp/help.jsp b/BKULocal/src/main/webapp/help.jsp
new file mode 100644
index 00000000..72781e38
--- /dev/null
+++ b/BKULocal/src/main/webapp/help.jsp
@@ -0,0 +1,29 @@
+
+<%@ page language="java" contentType="text/html; charset=UTF-8"
+ pageEncoding="UTF-8"%>
+<%@ page import="java.util.Locale"%>
+<%
+ String pathInfo[] = (request.getPathInfo() != null) ? request
+ .getPathInfo().split("/") : new String[] {};
+ String language = pathInfo[1].split("_")[0];
+ String filename = pathInfo[2];
+ String path = "/helpfiles/" + language.toLowerCase() + "/" + filename;
+ System.out.println(path);
+%>
+
+
diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.card.locked.html b/BKULocal/src/main/webapp/helpfiles/de/error.card.locked.html
new file mode 100644
index 00000000..c72ae275
--- /dev/null
+++ b/BKULocal/src/main/webapp/helpfiles/de/error.card.locked.html
@@ -0,0 +1,46 @@
+
+
+
+
+Untitled Document
+
+
+
+
+
+
+
+
+
Online-Hilfe
+
+
+
+
Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.
+
+
+
Fehler: Bürgerkarte ist gesperrt
+
Die Bürgerkartenfunktion auf der gesteckten Chipkarte ist gesperrt. Es stehen keine weiteren Versuche zur Eingabe einer PIN zur Verfügung, da zu oft eine falsche PIN eingegeben wurde.
+
Bitte wenden sie sich an den Aussteller der Karte.
+
+
diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.card.notactivated.png b/BKULocal/src/main/webapp/helpfiles/de/error.card.notactivated.png
new file mode 100644
index 00000000..dd48f92b
Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/error.card.notactivated.png differ
diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.html b/BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.html
new file mode 100644
index 00000000..c93bba48
--- /dev/null
+++ b/BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.html
@@ -0,0 +1,42 @@
+
+
+
+
+Untitled Document
+
+
+
+
+
+
+
+
+
Online-Hilfe
+
+
+
+
Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.
+
+
+
Fehler: Es konnte kein Kartenleser gefunden werden.
+
Für den Zugriff auf die Bürgerkarte ist ein Chipkartenleser erforderlich. Es werden grundsätzlich alle Kartenleser unterstützt, die über die PC/SC-Schnittstelle angesprochen werden können und im Betriebssystem erfolgreich installiert wurden. Es können mehrere unterstützte Kartenleser gleichzeitig angeschlossen werden.
+
Kartenleser die, die nicht über die PC/SC-Schnittstelle angesprochen werden können (z.B. Kartenleser für die nur CT-API-Treiber verfügbar sind) werden nicht unterstützt.
+
+
+
+
+
+
+
+
diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.png b/BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.png
new file mode 100644
index 00000000..4276347d
Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/error.cardterminal.png differ
diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.pcsc.html b/BKULocal/src/main/webapp/helpfiles/de/error.pcsc.html
new file mode 100644
index 00000000..44129e40
--- /dev/null
+++ b/BKULocal/src/main/webapp/helpfiles/de/error.pcsc.html
@@ -0,0 +1,40 @@
+
+
+
+
+Untitled Document
+
+
+
+
+
+
+
+
+
Online-Hilfe
+
+
+
+
Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.
+
+
+
Fehler: Es konnte keine PC/SC-Schnittstelle gefunden werden
+
Die Software für den Zugriff auf die Bürgerkarte konnte keine PC/SC-Schnittstelle für den Zugriff auf Kartenleser erkennen. Das Betriebssystem scheint keine PC/SC-Schnittstelle zur Verfügung zu stellen.
+
Unter Betriebssystemen die PCSC-Lite verwenden (Linux u.a.) tritt dieses Problem auch auf, wenn kein Kartenleser angeschlossen ist und daher der entsprechende Dienst nicht gestartet wurde oder wenn die entsprechende Bibliothek nicht zur Verfügung steht (weitere Informationen).
+
+
+
+
+
+
diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.pcsc.png b/BKULocal/src/main/webapp/helpfiles/de/error.pcsc.png
new file mode 100644
index 00000000..94940733
Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/error.pcsc.png differ
diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.html b/BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.html
new file mode 100644
index 00000000..c0f2c762
--- /dev/null
+++ b/BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.html
@@ -0,0 +1,39 @@
+
+
+
+
+Untitled Document
+
+
+
+
+
+
+
+
+
Online-Hilfe
+
+
+
+
Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.
+
+
+
Fehler: Der Server ist nicht erreichbar
+
Die Software zum Zugriff auf die Bürgerkarte konnte den Server nicht erreichen. Möglicherweise besteht derzeit ein Problem mit dem Dienst. Probieren Sie es daher zu einem späteren Zeitpunkt nochmal. Sollte das Problem dauerhaft bestehen, wenden Sie sich bitte an den Betreiber der Anwendung.
+
+
+
+
+
+
diff --git a/BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.png b/BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.png
new file mode 100644
index 00000000..2570a01f
Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/error.ws.unreachable.png differ
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.html b/BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.html
new file mode 100644
index 00000000..c647bf72
--- /dev/null
+++ b/BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.html
@@ -0,0 +1,47 @@
+
+
+
+
+Untitled Document
+
+
+
+
+
+
+
+
+
Online-Hilfe
+
+
+
+
Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.
+
+
+
Die Karte wird nicht unterstützt
+
Die im Kartenleser gesteckte Chipkarte wird nicht unterstützt.
+
Bitte stecken Sie eine unterstützte Chipkarte (Bürgerkarte) in den Kartenleser. Derzeit werden die folgenden Chipkarten unterstützt:
a-sign premium
+ Chipkarte der A-Trust GmbH bzw. diverse andere Chipkarten mit der Aufschrift 'a-sign premium'.
+
+
Sind mehrere unterstützte Kartenleser angeschlossen, stecken sie eine unterstützte Chipkarte (Bürgerkarte) in einen der angeschlossenen Kartenleser. Wird die Chipkarte erkannt wechselt die Bildschirmanzeige. Wird die Chipkarte nicht erkannt, wird der Kartenleser möglicherweise nicht unterstützt. Stecken Sie die Chipkarte daher in einen anderen Kartenleser.
+
+
+
+
+
+
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.png b/BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.png
new file mode 100644
index 00000000..23f6e2af
Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.cardnotsupported.png differ
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.cardpin.html b/BKULocal/src/main/webapp/helpfiles/de/help.cardpin.html
new file mode 100644
index 00000000..dc678fd0
--- /dev/null
+++ b/BKULocal/src/main/webapp/helpfiles/de/help.cardpin.html
@@ -0,0 +1,41 @@
+
+
+
+
+Untitled Document
+
+
+
+
+
+
+
+
+
Online-Hilfe
+
+
+
+
+
Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.
+
+
+
Lesen von Informationen von der Chipkarte
+
Sie werden aufgefordert ihre Karten-PIN bzw. Infobox-PIN (abhängig von der verwendeten Bürgerkarte) einzugeben um das Auslesen von Informationen zur Identifikation (Personenbindung) bzw. Vollmachten zu ermöglichen.
+
+
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.cardpin1.png b/BKULocal/src/main/webapp/helpfiles/de/help.cardpin1.png
new file mode 100644
index 00000000..4e1c2de8
Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.cardpin1.png differ
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.cardpin2.png b/BKULocal/src/main/webapp/helpfiles/de/help.cardpin2.png
new file mode 100644
index 00000000..cc5e599e
Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.cardpin2.png differ
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.html b/BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.html
new file mode 100644
index 00000000..f7cf15df
--- /dev/null
+++ b/BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.html
@@ -0,0 +1,39 @@
+
+
+
+
+Untitled Document
+
+
+
+
+
+
+
+
+
Online-Hilfe
+
+
+
+
Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.
+
+
+
Anzeige der Signaturdaten
+
Dieses Fenster zeigt die zu signierenden Daten an. Dies können entweder reine Textdaten oder XHTML sein. Im Falle von XHML erhalten Sie den Hinweis, dass es sich bei den dargestellten Daten nur um eine Voransicht handelt. Um die Daten standardkonform darzustellen, müssen diese abgespeichert und mit einem geeigneten XHTML Betrachter geöffnen werden.
+
In jedem Fall können die zu signierenden abgespeichert werden.
+
+
+
+
+
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.png b/BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.png
new file mode 100644
index 00000000..83004322
Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.hashdataviewer.png differ
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.insertcard.html b/BKULocal/src/main/webapp/helpfiles/de/help.insertcard.html
new file mode 100644
index 00000000..0bfc6230
--- /dev/null
+++ b/BKULocal/src/main/webapp/helpfiles/de/help.insertcard.html
@@ -0,0 +1,42 @@
+
+
+
+
+Untitled Document
+
+
+
+
+
+
+
+
+
Online-Hilfe
+
+
+
+
Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.
+
+
+
Bitte die Bürgerkarte in den Kartenleser stecken
+
Die Software für den Zugriff auf die Bürgerkarte hat einen oder mehrere unterstützte Kartenleser gefunden.
+
Bitte stecken Sie nun ihre Bürgerkarte in den Kartenleser. Wird die Karte erkannt, welchselt die Bildschirmanzeige.
+
Sollten Sie mehrere Kartenleser angeschlossen haben, wählen Sie einen beliebigen aus. Wird die Karte im ausgewählten Kartenleser nicht erkannt, wird dieser Kartenleser eventuell nicht unterstützt. Probieren Sie es daher in einem anderen Kartenleser nochmal.
+
+
+
+
+
+
+
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.insertcard.png b/BKULocal/src/main/webapp/helpfiles/de/help.insertcard.png
new file mode 100644
index 00000000..9930fcb4
Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.insertcard.png differ
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.retry.html b/BKULocal/src/main/webapp/helpfiles/de/help.retry.html
new file mode 100644
index 00000000..110d761f
--- /dev/null
+++ b/BKULocal/src/main/webapp/helpfiles/de/help.retry.html
@@ -0,0 +1,40 @@
+
+
+
+
+Untitled Document
+
+
+
+
+
+
+
+
+
Online-Hilfe
+
+
+
+
Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.
+
+
+
Falsche PIN
+
Die eingegebene PIN war falsch. Bitte geben Sie die korrekte PIN ein.
+
Die Anzahl der noch möglichen Versuche wird angezeigt.
+
+
+
+
+
+
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.retry.png b/BKULocal/src/main/webapp/helpfiles/de/help.retry.png
new file mode 100644
index 00000000..4cab2430
Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.retry.png differ
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.signpin-1.png b/BKULocal/src/main/webapp/helpfiles/de/help.signpin-1.png
new file mode 100644
index 00000000..1c5c8570
Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.signpin-1.png differ
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.signpin.html b/BKULocal/src/main/webapp/helpfiles/de/help.signpin.html
new file mode 100644
index 00000000..9ff79f3b
--- /dev/null
+++ b/BKULocal/src/main/webapp/helpfiles/de/help.signpin.html
@@ -0,0 +1,45 @@
+
+
+
+
+Untitled Document
+
+
+
+
+
+
+
+
+
Online-Hilfe
+
+
+
+
Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.
+
+
+
Erstellen einer elektronischen Signatur
+
Sie werden aufgefordert die Signatur-PIN einzugeben, um eine elektronische Signatur zu erstellen.
+
+
+
Klicken Sie auf 'Signaturdaten anzeigen' um die zu signierenden Daten anzuzeigen.
+
Geben Sie im Formularfeld die Signatur-PIN ein.
+
Klicken Sie auf die Schaltfläche 'Signieren' um die elektronische Signatur zu erstellen.
+
+
+
+
+
+
+
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.signpin.png b/BKULocal/src/main/webapp/helpfiles/de/help.signpin.png
new file mode 100644
index 00000000..6ffbf8df
Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.signpin.png differ
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.wait.html b/BKULocal/src/main/webapp/helpfiles/de/help.wait.html
new file mode 100644
index 00000000..ed3db1b8
--- /dev/null
+++ b/BKULocal/src/main/webapp/helpfiles/de/help.wait.html
@@ -0,0 +1,39 @@
+
+
+
+
+Untitled Document
+
+
+
+
+
+
+
+
+
Online-Hilfe
+
+
+
+
Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.
+
+
+
Bitte warten ...
+
Die Software für den Zugriff auf die Bürgerkarte ist damit beschäftigt, einen Befehl auszuführen bzw. auf einen neuen Befehl vom Server zu warten.
+
+
+
+
+
+
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.wait.png b/BKULocal/src/main/webapp/helpfiles/de/help.wait.png
new file mode 100644
index 00000000..812da0bd
Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.wait.png differ
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.welcome.html b/BKULocal/src/main/webapp/helpfiles/de/help.welcome.html
new file mode 100644
index 00000000..9796a206
--- /dev/null
+++ b/BKULocal/src/main/webapp/helpfiles/de/help.welcome.html
@@ -0,0 +1,40 @@
+
+
+
+
+Untitled Document
+
+
+
+
+
+
+
+
+
Online-Hilfe
+
+
+
+
Hinweis: Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.
+
+
+
Willkommen
+
Die Anzeige "Willkommen" erfolgt unmittelbar nachdem die Software für den Zugriff auf die Bürgerkarte erfolgreich im Browser geladen wurde.
+
Die Software versucht nun eine Verbindung mit dem Server aufzunehmen um Befehle für den Zugriff auf die Bürgerkarte zu erhalten.
+
+
+
+
+
+
diff --git a/BKULocal/src/main/webapp/helpfiles/de/help.welcome.png b/BKULocal/src/main/webapp/helpfiles/de/help.welcome.png
new file mode 100644
index 00000000..0be05a78
Binary files /dev/null and b/BKULocal/src/main/webapp/helpfiles/de/help.welcome.png differ
diff --git a/BKULocal/src/main/webapp/helpfiles/help.css b/BKULocal/src/main/webapp/helpfiles/help.css
new file mode 100644
index 00000000..28f9767b
--- /dev/null
+++ b/BKULocal/src/main/webapp/helpfiles/help.css
@@ -0,0 +1,81 @@
+@charset "UTF-8";
+body {
+ font: 100% Verdana, Arial, Helvetica, sans-serif;
+ background: #666666;
+ margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
+ padding: 0;
+ text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
+ color: #000000;
+}
+
+/* Tips for Elastic layouts
+1. Since the elastic layouts overall sizing is based on the user's default fonts size, they are more unpredictable. Used correctly, they are also more accessible for those that need larger fonts size since the line length remains proportionate.
+2. Sizing of divs in this layout are based on the 100% font size in the body element. If you decrease the text size overall by using a font-size: 80% on the body element or the #container, remember that the entire layout will downsize proportionately. You may want to increase the widths of the various divs to compensate for this.
+3. If font sizing is changed in differing amounts on each div instead of on the overall design (ie: #sidebar1 is given a 70% font size and #mainContent is given an 85% font size), this will proportionately change each of the divs overall size. You may want to adjust based on your final font sizing.
+*/
+.twoColElsLtHdr #container {
+ width: 46em; /* this width will create a container that will fit in an 800px browser window if text is left at browser default font sizes */
+ background: #FFFFFF;
+ margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
+ border: 1px solid #000000;
+ text-align: left; /* this overrides the text-align: center on the body element. */
+}
+.twoColElsLtHdr #header {
+ background: #DDDDDD;
+ padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
+}
+.twoColElsLtHdr #header h1 {
+ margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
+ padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
+}
+
+/* Tips for sidebar1:
+1. Be aware that if you set a font-size value on this div, the overall width of the div will be adjusted accordingly.
+2. Since we are working in ems, it's best not to use padding on the sidebar itself. It will be added to the width for standards compliant browsers creating an unknown actual width.
+3. Space between the side of the div and the elements within it can be created by placing a left and right margin on those elements as seen in the ".twoColElsLtHdr #sidebar1 p" rule.
+*/
+.twoColElsLtHdr #sidebar1 {
+ float: left;
+ width: 210px;
+ padding: 15px 0; /* top and bottom padding create visual space within this div */
+ background-color: #FFFFFF;
+}
+.twoColElsLtHdr #sidebar1 h3, .twoColElsLtHdr #sidebar1 p {
+ margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */
+ margin-right: 10px;
+}
+
+/* Tips for mainContent:
+1. If you give this #mainContent div a font-size value different than the #sidebar1 div, the margins of the #mainContent div will be based on its font-size and the width of the #sidebar1 div will be based on its font-size. You may wish to adjust the values of these divs.
+2. The space between the mainContent and sidebar1 is created with the left margin on the mainContent div. No matter how much content the sidebar1 div contains, the column space will remain. You can remove this left margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends.
+3. To avoid float drop, you may need to test to determine the approximate maximum image/element size since this layout is based on the user's font sizing combined with the values you set. However, if the user has their browser font size set lower than normal, less space will be available in the #mainContent div than you may see on testing.
+4. In the Internet Explorer Conditional Comment below, the zoom property is used to give the mainContent "hasLayout." This avoids several IE-specific bugs that may occur.
+*/
+.twoColElsLtHdr #mainContent {
+ margin: 0 1.5em 0 15em; /* the right margin can be given in ems or pixels. It creates the space down the right side of the page. */
+ padding: 0 10px;
+}
+.twoColElsLtHdr #footer {
+ padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
+ background:#DDDDDD;
+}
+.twoColElsLtHdr #footer p {
+ margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
+ padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
+}
+
+/* Miscellaneous classes for reuse */
+.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
+ float: right;
+ margin-left: 8px;
+}
+.fltlft { /* this class can be used to float an element left in your page */
+ float: left;
+ margin-right: 8px;
+}
+.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
+ clear:both;
+ height:0;
+ font-size: 1px;
+ line-height: 0px;
+}
\ No newline at end of file
diff --git a/BKULocal/src/main/webapp/helpfiles/index.html b/BKULocal/src/main/webapp/helpfiles/index.html
new file mode 100644
index 00000000..49aaed66
--- /dev/null
+++ b/BKULocal/src/main/webapp/helpfiles/index.html
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
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 d3cb76f2..5ee0058f 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -37,6 +37,7 @@ public interface BKUGUIFacade {
public static final String ERR_CARD_NOTACTIVATED = "error.card.notactivated";
public static final String ERR_VIEWER = "error.viewer";
public static final String ERR_EXTERNAL_LINK = "error.external.link";
+ public static final String ERR_CONFIG = "error.config";
public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages";
public static final String DEFAULT_BACKGROUND = "/images/BackgroundChipperling.png";
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 e560ca98..d2b47a9d 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
@@ -72,6 +72,7 @@ error.card.locked=B\u00FCrgerkarte ist gesperrt
error.card.notactivated=B\u00FCrgerkartenfunktion ist nicht aktiviert
error.viewer=Der Inhalt kann nicht dargestellt werden: {0}
error.external.link=Externer Link {0} wird nicht ge\u00F6ffnet
+error.config=Fehlerhafte Konfiguration des Systems: {0}
# Help Topics
help.welcome=Startseite
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 96f99a8a..524a2a98 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
@@ -68,7 +68,8 @@ error.test=Error1 {0} - Error2 {1}
error.card.locked=Citizen card is locked
error.card.notactivated=Citizen card not activated
error.viewer=Failed to display contents: {0}
-error.external.link=Externer Link {0} wird nicht ge\u00F6ffnet
+error.external.link=Cannot open external link {0}
+error.config=Incorrect system configuration: {0}
# Help Topics
help.welcome=Welcome page
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 252327d3..a617c61f 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
@@ -24,13 +24,14 @@ import at.gv.egiz.stal.QuitRequest;
import at.gv.egiz.stal.STALRequest;
import at.gv.egiz.stal.STALResponse;
import at.gv.egiz.stal.SignRequest;
+import at.gv.egiz.stal.service.translator.STALTranslator;
+import at.gv.egiz.stal.service.translator.TranslationException;
import at.gv.egiz.stal.service.types.InfoboxReadRequestType;
import at.gv.egiz.stal.service.types.ObjectFactory;
import at.gv.egiz.stal.service.types.QuitRequestType;
import at.gv.egiz.stal.service.types.RequestType;
import at.gv.egiz.stal.service.types.ResponseType;
import at.gv.egiz.stal.service.types.SignRequestType;
-import at.gv.egiz.stal.util.STALTranslator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -54,7 +55,8 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
private static final Log log = LogFactory.getLog(STALRequestBrokerImpl.class);
- private ObjectFactory stalObjFactory = new ObjectFactory();
+ private ObjectFactory of = new ObjectFactory();
+ private STALTranslator translator = new STALTranslator();
private boolean interrupted = false;
@@ -69,6 +71,7 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
if (timeoutMillisec <= 0)
timeoutMillisec = DEFAULT_TIMEOUT_MS;
timeout = timeoutMillisec;
+// translator.registerTranslationHandler(handler);
requests = new ArrayList>();
responses = new ArrayList>();
hashDataInputs = new ArrayList();
@@ -97,42 +100,70 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
hashDataInputs.clear();
for (STALRequest stalRequest : stalRequests) {
+ try {
+ JAXBElement extends RequestType> request = translator.translate(stalRequest);
+ requests.add(request);
if (stalRequest instanceof SignRequest) {
- log.trace("Received SignRequest, keep HashDataInput.");
- SignRequestType reqT = stalObjFactory.createSignRequestType();
- reqT.setKeyIdentifier(((SignRequest) stalRequest).getKeyIdentifier());
- reqT.setSignedInfo(((SignRequest) stalRequest).getSignedInfo());
- JAXBElement req = stalObjFactory.createGetNextRequestResponseTypeSignRequest(reqT);
- requests.add(req);
- //DataObjectHashDataInput with reference caching enabled DataObject
+ //TODO refactor SignRequestType to keep HDI
+ // and getHashDataInput() accesses request obj
+ // (requests are cleared only when we receive the response)
+ // DataObjectHashDataInput with reference caching enabled DataObject
hashDataInputs.addAll(((SignRequest) stalRequest).getHashDataInput());
- break;
- } else if (stalRequest instanceof InfoboxReadRequest) {
- log.trace("Received InfoboxReadRequest");
- InfoboxReadRequestType reqT = new InfoboxReadRequestType();
- reqT.setInfoboxIdentifier(((InfoboxReadRequest) stalRequest).getInfoboxIdentifier());
- reqT.setDomainIdentifier(((InfoboxReadRequest) stalRequest).getDomainIdentifier());
- JAXBElement req = stalObjFactory.createGetNextRequestResponseTypeInfoboxReadRequest(reqT);
- requests.add(req);
} else if (stalRequest instanceof QuitRequest) {
log.trace("Received QuitRequest, do not wait for responses.");
- QuitRequestType reqT = stalObjFactory.createQuitRequestType();
- JAXBElement req = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(reqT);
- requests.add(req);
- log.trace("notifying request consumers");
- requests.notify();
- return new ArrayList();
- } else {
- log.error("Received unsupported STAL request: " + stalRequest.getClass().getName() + ", send QUIT");
- requests.clear();
- QuitRequestType reqT = stalObjFactory.createQuitRequestType();
- JAXBElement req = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(reqT);
- requests.add(req);
log.trace("notifying request consumers");
requests.notify();
return new ArrayList();
}
+ } catch (TranslationException ex) {
+ log.error(ex.getMessage() + ", send QUIT");
+ requests.clear();
+ QuitRequestType reqT = of.createQuitRequestType();
+ JAXBElement req = of.createGetNextRequestResponseTypeQuitRequest(reqT);
+ requests.add(req);
+ log.trace("notifying request consumers");
+ requests.notify();
+ return new ArrayList();
+ }
}
+
+
+// if (stalRequest instanceof SignRequest) {
+// log.trace("Received SignRequest, keep HashDataInput.");
+// SignRequestType reqT = of.createSignRequestType();
+// reqT.setKeyIdentifier(((SignRequest) stalRequest).getKeyIdentifier());
+// reqT.setSignedInfo(((SignRequest) stalRequest).getSignedInfo());
+// JAXBElement req = of.createGetNextRequestResponseTypeSignRequest(reqT);
+// requests.add(req);
+// //DataObjectHashDataInput with reference caching enabled DataObject
+// hashDataInputs.addAll(((SignRequest) stalRequest).getHashDataInput());
+// break;
+// } else if (stalRequest instanceof InfoboxReadRequest) {
+// log.trace("Received InfoboxReadRequest");
+// InfoboxReadRequestType reqT = new InfoboxReadRequestType();
+// reqT.setInfoboxIdentifier(((InfoboxReadRequest) stalRequest).getInfoboxIdentifier());
+// reqT.setDomainIdentifier(((InfoboxReadRequest) stalRequest).getDomainIdentifier());
+// JAXBElement req = of.createGetNextRequestResponseTypeInfoboxReadRequest(reqT);
+// requests.add(req);
+// } else if (stalRequest instanceof QuitRequest) {
+// log.trace("Received QuitRequest, do not wait for responses.");
+// QuitRequestType reqT = of.createQuitRequestType();
+// JAXBElement req = of.createGetNextRequestResponseTypeQuitRequest(reqT);
+// requests.add(req);
+// log.trace("notifying request consumers");
+// requests.notify();
+// return new ArrayList();
+// } else {
+// log.error("Received unsupported STAL request: " + stalRequest.getClass().getName() + ", send QUIT");
+// requests.clear();
+// QuitRequestType reqT = of.createQuitRequestType();
+// JAXBElement req = of.createGetNextRequestResponseTypeQuitRequest(reqT);
+// requests.add(req);
+// log.trace("notifying request consumers");
+// requests.notify();
+// return new ArrayList();
+// }
+// }
log.trace("notifying request consumers");
requests.notify();
}
@@ -150,12 +181,24 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
}
}
log.trace("consuming responses");
- List resps = STALTranslator.toSTAL(responses);
+ List stalResponses = new ArrayList();
+ try {
+ for (JAXBElement extends ResponseType> resp : responses) {
+ STALResponse stalResp = translator.translate(resp);
+ stalResponses.add(stalResp);
+ }
+ } catch (TranslationException ex) {
+ log.error(ex.getMessage() + ", return ErrorResponse (4000)");
+ ErrorResponse stalResp = new ErrorResponse(4000);
+ stalResp.setErrorMessage(ex.getMessage());
+ stalResponses = Collections.singletonList((STALResponse) stalResp);
+ }
+
responses.clear();
log.trace("notifying response producers");
responses.notify();
- return resps;
+ return stalResponses;
}
} catch (InterruptedException ex) {
log.warn("interrupt in handleRequest(): " + ex.getMessage());
@@ -277,8 +320,8 @@ public class STALRequestBrokerImpl implements STALRequestBroker {
}
private List> createSingleQuitRequest() {
- QuitRequestType quitT = stalObjFactory.createQuitRequestType();
- JAXBElement quit = stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT);
+ QuitRequestType quitT = of.createQuitRequestType();
+ JAXBElement quit = of.createGetNextRequestResponseTypeQuitRequest(quitT);
ArrayList> l = new ArrayList>();
l.add(quit);
return l;
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 45629869..afeba9cb 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
@@ -147,8 +147,8 @@ public class STALServiceImpl implements STALPortType {
sb.append("] containing ");
sb.append(responsesIn.size());
sb.append(" responses: ");
- for (Object respIn : responsesIn) {
- sb.append(respIn.getClass());
+ for (JAXBElement extends ResponseType> respIn : responsesIn) {
+ sb.append(respIn.getValue().getClass());
sb.append(' ');
}
log.debug(sb.toString());
diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java b/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java
new file mode 100644
index 00000000..c4a3d62e
--- /dev/null
+++ b/STALService/src/main/java/at/gv/egiz/stal/service/translator/STALTranslator.java
@@ -0,0 +1,274 @@
+/*
+ * 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.service.translator;
+
+import at.gv.egiz.stal.ErrorResponse;
+import at.gv.egiz.stal.InfoboxReadRequest;
+import at.gv.egiz.stal.InfoboxReadResponse;
+import at.gv.egiz.stal.QuitRequest;
+import at.gv.egiz.stal.STALRequest;
+import at.gv.egiz.stal.STALResponse;
+import at.gv.egiz.stal.SignRequest;
+import at.gv.egiz.stal.SignResponse;
+import at.gv.egiz.stal.service.types.ErrorResponseType;
+import at.gv.egiz.stal.service.types.InfoboxReadRequestType;
+import at.gv.egiz.stal.service.types.InfoboxReadResponseType;
+import at.gv.egiz.stal.service.types.ObjectFactory;
+import at.gv.egiz.stal.service.types.QuitRequestType;
+import at.gv.egiz.stal.service.types.RequestType;
+import at.gv.egiz.stal.service.types.ResponseType;
+import at.gv.egiz.stal.service.types.SignRequestType;
+import at.gv.egiz.stal.service.types.SignResponseType;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.bind.JAXBElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class STALTranslator {
+
+ private static final Log log = LogFactory.getLog(STALTranslator.class);
+ protected Map handlerMap = new HashMap();
+
+ public STALTranslator() {
+ registerTranslationHandler(new DefaultTranslationHandler());
+ }
+
+ /**
+ * overwrites previously registered handlers for the same type
+ * @param handler
+ */
+ public void registerTranslationHandler(TranslationHandler handler) {
+ for (Class t : handler.getSupportedTypes()) {
+ if (log.isDebugEnabled()) {
+ log.debug("register " + t + " with translation handler " + handler.getClass());
+ }
+ handlerMap.put(t, handler);
+ }
+ }
+
+ /**
+ * Translate a STAL request to a STAL Webservice request.
+ * @param request
+ * @return
+ * @throws at.gv.egiz.stal.service.translator.TranslationException
+ */
+ public JAXBElement extends RequestType> translate(STALRequest request) throws TranslationException {
+ if (handlerMap.containsKey(request.getClass())) {
+ TranslationHandler handler = handlerMap.get(request.getClass());
+ JAXBElement extends RequestType> r = handler.translate(request);
+ if (r != null) {
+ return r;
+ }
+ }
+ log.error("unknown STAL request type " + request.getClass());
+ throw new TranslationException(request.getClass());
+ }
+
+ /**
+ * Translate a STAL Webservice request to a STAL request.
+ * @param request
+ * @return
+ * @throws at.gv.egiz.stal.service.translator.TranslationException
+ */
+ public STALRequest translate(JAXBElement extends RequestType> request) throws TranslationException {
+ RequestType req = request.getValue();
+ if (req == null) {
+ throw new RuntimeException("RequestType must not be null");
+ }
+ if (handlerMap.containsKey(req.getClass())) {
+ TranslationHandler handler = handlerMap.get(req.getClass());
+ STALRequest stalRequest = handler.translate(req);
+ if (stalRequest != null) {
+ return stalRequest;
+ }
+ }
+ log.error("unknown request type " + req.getClass());
+ throw new TranslationException(req.getClass());
+ }
+
+ /**
+ * Translate a STAL response to a STAL Webservice response.
+ * @param request
+ * @return
+ * @throws at.gv.egiz.stal.service.translator.TranslationException
+ */
+ public JAXBElement extends ResponseType> translate(STALResponse response) throws TranslationException {
+ if (handlerMap.containsKey(response.getClass())) {
+ TranslationHandler handler = handlerMap.get(response.getClass());
+ JAXBElement extends ResponseType> r = handler.translate(response);
+ if (r != null) {
+ return r;
+ }
+ }
+ log.error("unknown STAL response type " + response.getClass());
+ throw new TranslationException(response.getClass());
+ }
+
+ /**
+ * Translate a STAL Webservice response to a STAL response.
+ * @param request
+ * @return
+ * @throws at.gv.egiz.stal.service.translator.TranslationException
+ */
+ public STALResponse translate(JAXBElement extends ResponseType> response) throws TranslationException {
+ ResponseType resp = response.getValue();
+ if (resp == null) {
+ throw new RuntimeException("ResponseType must not be null");
+ }
+ if (handlerMap.containsKey(resp.getClass())) {
+ TranslationHandler handler = handlerMap.get(resp.getClass());
+ STALResponse stalResponse = handler.translate(resp);
+ if (stalResponse != null) {
+ return stalResponse;
+ }
+ }
+ log.error("unknown response type " + resp.getClass());
+ throw new TranslationException(resp.getClass());
+ }
+
+ /**
+ * public (static) interface implemented by STAL extensions
+ */
+ public static interface TranslationHandler {
+
+ List getSupportedTypes();
+
+ JAXBElement extends RequestType> translate(STALRequest request) throws TranslationException;
+
+ STALRequest translate(RequestType request) throws TranslationException;
+
+ JAXBElement extends ResponseType> translate(STALResponse response) throws TranslationException;
+
+ STALResponse translate(ResponseType response) throws TranslationException;
+ }
+
+
+ /**
+ * Default Handler
+ */
+ protected static class DefaultTranslationHandler implements TranslationHandler {
+
+ private static final Log log = LogFactory.getLog(DefaultTranslationHandler.class);
+ private ObjectFactory of;
+
+ public DefaultTranslationHandler() {
+ of = new ObjectFactory();
+ }
+
+ @Override
+ public List getSupportedTypes() {
+// log.warn(" *** Fake STALTranslator ***");
+ return Arrays.asList(new Class[]{InfoboxReadRequest.class,
+ SignRequest.class,
+ QuitRequest.class,
+ InfoboxReadRequestType.class,
+ SignRequestType.class,
+ QuitRequestType.class,
+ InfoboxReadResponse.class,
+ SignResponse.class,
+ ErrorResponse.class,
+ InfoboxReadResponseType.class,
+ SignResponseType.class,
+ ErrorResponseType.class
+ });
+ }
+
+ @Override
+ public JAXBElement extends RequestType> translate(STALRequest request) throws TranslationException {
+ log.trace("translate " + request.getClass());
+ if (request instanceof SignRequest) {
+ SignRequestType req = of.createSignRequestType();
+ req.setKeyIdentifier(((SignRequest) request).getKeyIdentifier());
+ req.setSignedInfo(((SignRequest) request).getSignedInfo());
+ //TODO add hashdatainput (refactor signRequestType)
+ return of.createGetNextRequestResponseTypeSignRequest(req);
+ } else if (request instanceof InfoboxReadRequest) {
+ InfoboxReadRequestType req = of.createInfoboxReadRequestType();
+ req.setInfoboxIdentifier(((InfoboxReadRequest) request).getInfoboxIdentifier());
+ req.setDomainIdentifier(((InfoboxReadRequest) request).getDomainIdentifier());
+ return of.createGetNextRequestResponseTypeInfoboxReadRequest(req);
+ } else if (request instanceof QuitRequest) {
+ return of.createGetNextRequestResponseTypeQuitRequest(of.createQuitRequestType());
+ }
+ throw new TranslationException(request.getClass());
+ }
+
+ @Override
+ public STALRequest translate(RequestType request) throws TranslationException {
+ if (request instanceof InfoboxReadRequestType) {
+ InfoboxReadRequest stalReq = new InfoboxReadRequest();
+ stalReq.setDomainIdentifier(((InfoboxReadRequestType) request).getDomainIdentifier());
+ stalReq.setInfoboxIdentifier(((InfoboxReadRequestType) request).getInfoboxIdentifier());
+ return stalReq;
+ } else if (request instanceof SignRequestType) {
+ SignRequest stalReq = new SignRequest();
+ stalReq.setKeyIdentifier(((SignRequestType) request).getKeyIdentifier());
+ stalReq.setSignedInfo(((SignRequestType) request).getSignedInfo());
+ return stalReq;
+ } else if (request instanceof QuitRequestType) {
+ return new QuitRequest();
+ }
+ throw new TranslationException(request.getClass());
+ }
+
+ @Override
+ public JAXBElement extends ResponseType> translate(STALResponse response) throws TranslationException {
+ if (response instanceof InfoboxReadResponse) {
+ InfoboxReadResponseType resp = of.createInfoboxReadResponseType();
+ resp.setInfoboxValue(((InfoboxReadResponse) response).getInfoboxValue());
+ return of.createGetNextRequestTypeInfoboxReadResponse(resp);
+ } else if (response instanceof SignResponse) {
+ SignResponseType resp = of.createSignResponseType();
+ resp.setSignatureValue(((SignResponse) response).getSignatureValue());
+ return of.createGetNextRequestTypeSignResponse(resp);
+ } else if (response instanceof ErrorResponse) {
+ ErrorResponseType resp = of.createErrorResponseType();
+ resp.setErrorCode(((ErrorResponse) response).getErrorCode());
+ resp.setErrorMessage(((ErrorResponse) response).getErrorMessage());
+ return of.createGetNextRequestTypeErrorResponse(resp);
+ }
+ throw new TranslationException(response.getClass());
+ }
+
+ @Override
+ public STALResponse translate(ResponseType response) throws TranslationException {
+ if (response instanceof InfoboxReadResponseType) {
+ InfoboxReadResponse stalResp = new InfoboxReadResponse();
+ stalResp.setInfoboxValue(((InfoboxReadResponseType) response).getInfoboxValue());
+ return stalResp;
+ } else if (response instanceof SignResponseType) {
+ SignResponse stalResp = new SignResponse();
+ stalResp.setSignatureValue(((SignResponseType) response).getSignatureValue());
+ return stalResp;
+ } else if (response instanceof ErrorResponseType) {
+ ErrorResponse stalResp = new ErrorResponse();
+ stalResp.setErrorCode(((ErrorResponseType) response).getErrorCode());
+ stalResp.setErrorMessage(((ErrorResponseType) response).getErrorMessage());
+ return stalResp;
+ }
+ throw new TranslationException(response.getClass());
+ }
+ }
+}
+
diff --git a/STALService/src/main/java/at/gv/egiz/stal/service/translator/TranslationException.java b/STALService/src/main/java/at/gv/egiz/stal/service/translator/TranslationException.java
new file mode 100644
index 00000000..fd9da988
--- /dev/null
+++ b/STALService/src/main/java/at/gv/egiz/stal/service/translator/TranslationException.java
@@ -0,0 +1,42 @@
+/*
+ * 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.service.translator;
+
+/**
+ *
+ * @author Clemens Orthacker
+ */
+public class TranslationException extends Exception {
+
+ private Class unknownClass;
+
+ /**
+ * Creates a new instance of TranslationException without detail message.
+ * @param unknownClass the class that could not be translated
+ */
+ public TranslationException(Class unkownClass) {
+ this.unknownClass = unkownClass;
+ }
+
+ @Override
+ public String getMessage() {
+ return "Failed to translate type " + unknownClass;
+ }
+
+
+
+}
diff --git a/STALService/src/main/java/at/gv/egiz/stal/util/STALTranslator.java b/STALService/src/main/java/at/gv/egiz/stal/util/STALTranslator.java
deleted file mode 100644
index 6bbd7301..00000000
--- a/STALService/src/main/java/at/gv/egiz/stal/util/STALTranslator.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package at.gv.egiz.stal.util;
-
-import at.gv.egiz.stal.ErrorResponse;
-import at.gv.egiz.stal.InfoboxReadRequest;
-import at.gv.egiz.stal.InfoboxReadResponse;
-import at.gv.egiz.stal.QuitRequest;
-import at.gv.egiz.stal.STALRequest;
-import at.gv.egiz.stal.STALResponse;
-import at.gv.egiz.stal.SignRequest;
-import at.gv.egiz.stal.SignResponse;
-import at.gv.egiz.stal.service.types.*;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import javax.xml.bind.JAXBElement;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-/**
- *
- * @author clemens
- */
-public class STALTranslator {
-
- protected static final Log log = LogFactory.getLog(STALTranslator.class);
-
- public static List translateRequests(List> requests) {
- List stalRequests = new ArrayList(requests.size());
- for (JAXBElement extends RequestType> requestElt : requests) {
- RequestType request = requestElt.getValue();
- if (request instanceof InfoboxReadRequestType) {
- InfoboxReadRequest stalReq = new InfoboxReadRequest();
- stalReq.setDomainIdentifier(((InfoboxReadRequestType) request).getDomainIdentifier());
- stalReq.setInfoboxIdentifier(((InfoboxReadRequestType) request).getInfoboxIdentifier());
- stalRequests.add(stalReq);
- } else if (request instanceof SignRequestType) {
- SignRequest stalReq = new SignRequest();
- stalReq.setKeyIdentifier(((SignRequestType) request).getKeyIdentifier());
- stalReq.setSignedInfo(((SignRequestType) request).getSignedInfo());
- stalRequests.add(stalReq);
- } else if (request instanceof QuitRequestType) {
- stalRequests.add(new QuitRequest());
- } else {
- log.error("unknown STALService request type: " + request.getClass());
- stalRequests = Collections.singletonList((STALRequest) new QuitRequest());
- break;
- }
- }
- return stalRequests;
- }
-
- public static List> fromSTAL(List stalResponses) {
- ObjectFactory stalObjFactory = new ObjectFactory();
- List> responses = new ArrayList>(stalResponses.size());
- for (STALResponse stalResp : stalResponses) {
- if (stalResp instanceof InfoboxReadResponse) {
- InfoboxReadResponseType resp = stalObjFactory.createInfoboxReadResponseType();
- resp.setInfoboxValue(((InfoboxReadResponse) stalResp).getInfoboxValue());
- responses.add(stalObjFactory.createGetNextRequestTypeInfoboxReadResponse(resp));
- } else if (stalResp instanceof SignResponse) {
- SignResponseType resp = stalObjFactory.createSignResponseType();
- resp.setSignatureValue(((SignResponse) stalResp).getSignatureValue());
- responses.add(stalObjFactory.createGetNextRequestTypeSignResponse(resp));
- } else if (stalResp instanceof ErrorResponse) {
- ErrorResponseType resp = stalObjFactory.createErrorResponseType();
- resp.setErrorCode(((ErrorResponse) stalResp).getErrorCode());
- resp.setErrorMessage(((ErrorResponse) stalResp).getErrorMessage());
- responses.add(stalObjFactory.createGetNextRequestTypeErrorResponse(resp));
- } else {
- log.error("unknown STAL response type: " + stalResp.getClass());
- ErrorResponseType resp = stalObjFactory.createErrorResponseType();
- resp.setErrorCode(4000);
- resp.setErrorMessage("unknown STAL response type: " + stalResp.getClass());
- responses.clear();
- responses.add(stalObjFactory.createGetNextRequestTypeErrorResponse(resp));
- break;
- }
- }
- return responses;
- }
-
- public static List toSTAL(List> responses) {
- List stalResponses = new ArrayList(responses.size());
- for (JAXBElement extends ResponseType> respElt : responses) {
- ResponseType resp = respElt.getValue();
- if (resp instanceof InfoboxReadResponseType) {
- InfoboxReadResponse stalResp = new InfoboxReadResponse();
- stalResp.setInfoboxValue(((InfoboxReadResponseType) resp).getInfoboxValue());
- stalResponses.add(stalResp);
- } else if (resp instanceof SignResponseType) {
- SignResponse stalResp = new SignResponse();
- stalResp.setSignatureValue(((SignResponseType) resp).getSignatureValue());
- stalResponses.add(stalResp);
- } else if (resp instanceof ErrorResponseType) {
- ErrorResponse stalResp = new ErrorResponse();
- stalResp.setErrorCode(((ErrorResponseType) resp).getErrorCode());
- stalResp.setErrorMessage(((ErrorResponseType) resp).getErrorMessage());
- stalResponses.add(stalResp);
- } else {
- log.error("unknown STALService response type: " + resp.getClass());
- ErrorResponse stalResp = new ErrorResponse();
- stalResp.setErrorCode(4000);
- stalResp.setErrorMessage("unknown STALService response type: " + resp.getClass());
- stalResponses = Collections.singletonList((STALResponse) stalResp);
- break;
- }
- }
- return stalResponses;
- }
-}
diff --git a/STALService/src/test/java/at/gv/egiz/stal/service/translator/STALTranslatorTest.java b/STALService/src/test/java/at/gv/egiz/stal/service/translator/STALTranslatorTest.java
new file mode 100644
index 00000000..1dad7973
--- /dev/null
+++ b/STALService/src/test/java/at/gv/egiz/stal/service/translator/STALTranslatorTest.java
@@ -0,0 +1,146 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package at.gv.egiz.stal.service.translator;
+
+import at.gv.egiz.stal.STALRequest;
+import at.gv.egiz.stal.STALResponse;
+import at.gv.egiz.stal.SignRequest;
+import at.gv.egiz.stal.service.translator.STALTranslator.TranslationHandler;
+import at.gv.egiz.stal.service.types.ObjectFactory;
+import at.gv.egiz.stal.service.types.RequestType;
+import at.gv.egiz.stal.service.types.ResponseType;
+import at.gv.egiz.stal.service.types.SignRequestType;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ * @author clemens
+ */
+public class STALTranslatorTest {
+
+ static ObjectFactory of;
+
+ public STALTranslatorTest() {
+ }
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ of = new ObjectFactory();
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+ }
+
+ @Before
+ public void setUp() {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ /**
+ * Test of registerTranslationHandler method, of class STALTranslator.
+ */
+ @Test
+ @Ignore
+ public void testRegisterTranslationHandler() {
+ System.out.println("registerTranslationHandler");
+ TranslationHandler handler = null;
+ STALTranslator instance = new STALTranslator();
+ instance.registerTranslationHandler(handler);
+
+ // TODO review the generated test code and remove the default call to fail.
+ fail("The test case is a prototype.");
+ }
+
+ /**
+ * Test of translate method, of class STALTranslator.
+ */
+ @Test
+ public void testTranslate_STALRequest() throws Exception {
+ System.out.println("translate");
+ SignRequest request = new SignRequest();
+ request.setKeyIdentifier("kid");
+ request.setSignedInfo("signedinfo".getBytes());
+ STALTranslator instance = new STALTranslator();
+ JAXBElement extends RequestType> result = instance.translate(request);
+ assertEquals(SignRequestType.class, result.getValue().getClass());
+ SignRequestType resultT = (SignRequestType) result.getValue();
+ assertEquals(request.getKeyIdentifier(), resultT.getKeyIdentifier());
+ assertEquals(request.getSignedInfo(), resultT.getSignedInfo());
+ }
+
+ /**
+ * Test of translate method, of class STALTranslator.
+ */
+ @Test
+ public void testTranslate_1args_1() throws Exception {
+ System.out.println("translate");
+ SignRequestType req = of.createSignRequestType();
+ req.setKeyIdentifier("kid");
+ req.setSignedInfo("signedinfo".getBytes());
+ JAXBElement extends RequestType> request = of.createGetNextRequestResponseTypeSignRequest(req);
+ STALTranslator instance = new STALTranslator();
+ STALRequest result = instance.translate(request);
+ assertEquals(SignRequest.class, result.getClass());
+ assertEquals(req.getKeyIdentifier(), ((SignRequest) result).getKeyIdentifier());
+ assertEquals(req.getSignedInfo(), ((SignRequest) result).getSignedInfo());
+ }
+
+ @Test(expected=RuntimeException.class)
+ public void testTranslate_invalidInput() throws Exception {
+ System.out.println("translate");
+ QName n = new QName("http://www.egiz.gv.at/stal", "SignRequest");
+ JAXBElement extends RequestType> request = new JAXBElement(n, SignRequestType.class, null);
+ STALTranslator instance = new STALTranslator();
+ STALRequest result = instance.translate(request);
+ assertEquals(SignRequest.class, result.getClass());
+ }
+
+
+ /**
+ * Test of translate method, of class STALTranslator.
+ */
+ @Test
+ @Ignore
+ public void testTranslate_STALResponse() throws Exception {
+ System.out.println("translate");
+ STALResponse response = null;
+ STALTranslator instance = new STALTranslator();
+ JAXBElement extends ResponseType> expResult = null;
+ JAXBElement extends ResponseType> result = instance.translate(response);
+ assertEquals(expResult, result);
+ // TODO review the generated test code and remove the default call to fail.
+ fail("The test case is a prototype.");
+ }
+
+ /**
+ * Test of translate method, of class STALTranslator.
+ */
+ @Test
+ @Ignore
+ public void testTranslate_1args_2() throws Exception {
+ System.out.println("translate");
+ JAXBElement extends ResponseType> response = null;
+ STALTranslator instance = new STALTranslator();
+ STALResponse expResult = null;
+ STALResponse result = instance.translate(response);
+ assertEquals(expResult, result);
+ // TODO review the generated test code and remove the default call to fail.
+ fail("The test case is a prototype.");
+ }
+
+}
\ No newline at end of file
diff --git a/STALService/src/test/resources/commons-logging.properties b/STALService/src/test/resources/commons-logging.properties
new file mode 100644
index 00000000..29292562
--- /dev/null
+++ b/STALService/src/test/resources/commons-logging.properties
@@ -0,0 +1 @@
+org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger
--
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/main/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/main/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/main/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:TransformInfos
- *
- * @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:TransformInfos
+ *
+ * @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.
+ *