summaryrefslogtreecommitdiff
path: root/BKUCommonGUI/src
diff options
context:
space:
mode:
Diffstat (limited to 'BKUCommonGUI/src')
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java3
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java15
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java72
-rw-r--r--BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties3
-rw-r--r--BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties3
-rw-r--r--BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java6
-rw-r--r--BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java5
7 files changed, 59 insertions, 48 deletions
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index 7d912f11..d3cb76f2 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -62,11 +62,12 @@ public interface BKUGUIFacade {
public static final String MESSAGE_INSERTCARD = "message.insertcard";
public static final String MESSAGE_ENTERPIN = "message.enterpin";
public static final String MESSAGE_HASHDATALINK = "message.hashdatalink";
- public static final String MESSAGE_HASHDATA = "message.hashdata";
+// public static final String MESSAGE_HASHDATA = "message.hashdata";
public static final String MESSAGE_HASHDATALIST = "message.hashdatalist";
public static final String MESSAGE_RETRIES = "message.retries";
public static final String MESSAGE_OVERWRITE = "message.overwrite";
public static final String MESSAGE_HELP = "message.help";
+ public static final String WARNING_XHTML = "warning.xhtml";
public static final String LABEL_PIN = "label.pin";
public static final String LABEL_PINSIZE = "label.pinsize";
public static final String HELP_WELCOME = "help.welcome";
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java
index a190b9c0..c786a291 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java
@@ -208,13 +208,16 @@ public class BKUGUIImpl implements BKUGUIFacade {
if (background == null) {
background = getClass().getResource(DEFAULT_BACKGROUND);
}
- if ("file".equals(background.getProtocol())) {
- log.warn("file:// background images not permitted: " + background);
- background = getClass().getResource(DEFAULT_BACKGROUND);
+ if (background == null) {
+ contentPanel = new JPanel();
+ } else {
+ if ("file".equals(background.getProtocol())) {
+ log.warn("file:// background images not permitted: " + background);
+ background = getClass().getResource(DEFAULT_BACKGROUND);
+ }
+ log.debug("loading background " + background);
+ contentPanel = new ImagePanel(background);
}
- log.debug("loading background " + background);
- contentPanel = new ImagePanel(background);
-
mainPanel = new JPanel();
mainPanel.setOpaque(false);
buttonPanel = new JPanel();
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
index 777e8960..6c097b2a 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/HashDataViewer.java
@@ -125,9 +125,7 @@ public class HashDataViewer extends JDialog
InputStreamReader isr = new InputStreamReader(hashDataInput.getHashDataInput(), cs);
Reader content = new BufferedReader(isr);
- JPanel hashDataPanel = createViewerPanel(
- messages.getString(BKUGUIFacade.MESSAGE_HASHDATA),
- content,
+ JPanel hashDataPanel = createViewerPanel(content,
hashDataInput.getMimeType(),
helpListener);
JPanel buttonPanel = createButtonPanel(saveListener, saveCommand);
@@ -169,29 +167,28 @@ public class HashDataViewer extends JDialog
* @param helpListener may be null
* @return
*/
- private JPanel createViewerPanel(String viewerLabelText,
- Reader content,
+ private JPanel createViewerPanel(Reader content,
String mimeType,
final ActionListener helpListener) {
- log.debug("viewer dialog: " + mimeType);
if (mimeType == null) {
mimeType = "text/plain";
- } else if ("application/xhtml+xml".equals(mimeType)) {
- mimeType = "text/html";
}
+ log.debug("viewer dialog: " + mimeType);
JEditorPane viewer = new JEditorPane();
+ viewer.setEditable(false);
+ viewer.setContentType(mimeType);
if ("text/plain".equals(mimeType)) {
viewer.setEditorKit(new StyledEditorKit());
viewer.setFont(new Font(PLAINTEXT_FONT, viewer.getFont().getStyle(), viewer.getFont().getSize()));
// } else if ("text/html".equals(mimeType)) {
// viewer.setEditorKit(new RestrictedHTMLEditorKit());
+ } else if ("application/xhtml+xml".equals(mimeType)) {
+ viewer.setContentType("text/html");
}
- viewer.setEditable(false);
- viewer.setContentType(mimeType);
-
+
EditorKit editorKit = viewer.getEditorKit();
Document document = editorKit.createDefaultDocument();
// document.putProperty("IgnoreCharsetDirective", new Boolean(true));
@@ -210,15 +207,23 @@ public class HashDataViewer extends JDialog
scrollPane.setAlignmentX(LEFT_ALIGNMENT);
viewer.setCaretPosition(0);
- JLabel viewerLabel = new JLabel();
- viewerLabel.setText(viewerLabelText);
- viewerLabel.setFont(viewerLabel.getFont().deriveFont(viewerLabel.getFont().getStyle() | java.awt.Font.BOLD));
- viewerLabel.setLabelFor(viewer);
-
JPanel viewerPanel = new JPanel();
GroupLayout viewerPanelLayout = new GroupLayout(viewerPanel);
viewerPanel.setLayout(viewerPanelLayout);
+ GroupLayout.SequentialGroup infoHorizontal = viewerPanelLayout.createSequentialGroup();
+ GroupLayout.ParallelGroup infoVertical = viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING);
+
+ if ("application/xhtml+xml".equals(mimeType)) {
+ JLabel viewerLabel = new JLabel();
+ viewerLabel.setText(messages.getString(BKUGUIFacade.WARNING_XHTML));
+ viewerLabel.setFont(viewerLabel.getFont().deriveFont(viewerLabel.getFont().getStyle() | java.awt.Font.BOLD));
+ viewerLabel.setLabelFor(viewer);
+
+ infoHorizontal.addComponent(viewerLabel);
+ infoVertical.addComponent(viewerLabel);
+ }
+
if (helpListener != null) {
JLabel helpLabel = new JLabel();
helpLabel.setIcon(new ImageIcon(getClass().getResource(BKUGUIFacade.HELP_IMG)));
@@ -232,27 +237,24 @@ public class HashDataViewer extends JDialog
}
});
helpLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
- viewerPanelLayout.setHorizontalGroup(
- viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(viewerPanelLayout.createSequentialGroup().addComponent(viewerLabel).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel)).addComponent(scrollPane)); //, 0, 0, Short.MAX_VALUE));
- viewerPanelLayout.setVerticalGroup(
- viewerPanelLayout.createSequentialGroup()
- .addGroup(viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(viewerLabel)
- .addComponent(helpLabel))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(scrollPane));
- } else {
- viewerPanelLayout.setHorizontalGroup(
- viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
- .addComponent(viewerLabel)
- .addComponent(scrollPane));
- viewerPanelLayout.setVerticalGroup(
- viewerPanelLayout.createSequentialGroup()
- .addComponent(viewerLabel)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(scrollPane));
+ infoHorizontal
+ .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE)
+ .addComponent(helpLabel);
+ infoVertical
+ .addComponent(helpLabel);
}
+
+ viewerPanelLayout.setHorizontalGroup(
+ viewerPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(infoHorizontal)
+ .addComponent(scrollPane));
+ viewerPanelLayout.setVerticalGroup(
+ viewerPanelLayout.createSequentialGroup()
+ .addGroup(infoVertical)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(scrollPane));
+
return viewerPanel;
}
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index 88119fe2..a7363421 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -32,13 +32,14 @@ message.wait=<html>Bitte warten...</html>
message.insertcard=<html>Bitte die B\u00FCrgerkarte in den Kartenleser stecken</html>
message.enterpin=<html>{0} eingeben</html>
message.hashdatalink=<html><a href=\"anzeige\">Signaturdaten anzeigen</a></html>
-message.hashdata=<html>Hinweis: Dies ist eine Voransicht des zu signierenden Inhalts. F\u00FCr eine standardkonforme Darstellung siehe Hilfe (i).</html>
+#message.hashdata=<html>Hinweis: Dies ist eine Voransicht des zu signierenden Inhalts. F\u00FCr eine standardkonforme Darstellung siehe Hilfe (i).</html>
#message.hashdata=<html>Dies ist eine Voransicht des zu signierenden Inhaltes. F\u00FCr Details siehe Hilfe (i).</html>
#verwenden sie bitte die von ihrem System zur Verf\u00FCgung gestellte {0} Anwendung.
message.hashdatalist=<html>{0} Signaturdaten:</html>
message.retries=<html>Noch {0} Versuch(e)</html>
message.overwrite=<html>M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?</html>
message.help=<html>Hilfe zu {0}</html>
+warning.xhtml=<html>Hinweis: Dies ist eine Voransicht des zu signierenden Inhalts. F\u00FCr eine standardkonforme Darstellung siehe Hilfe (i).</html>
label.pin=<html>{0}:</html>
label.pinsize=<html>({0} stellig)</html>
button.ok=OK
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
index 63c8bf77..7aae8eae 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties
@@ -32,11 +32,12 @@ message.wait=<html>Please wait...</html>
message.insertcard=<html>Please insert your citizencard into the reader</html>
message.enterpin=<html>Enter {0}</html>
message.hashdatalink=<html><a href=\"anzeige\">Display signature data</a></html>
-message.hashdata=<html>Remark: This is a preview of the data to-be signed. For standards compliant display see help.</html>
+#message.hashdata=<html>Remark: This is a preview of the data to-be signed. For standards compliant display see help.</html>
message.hashdatalist=<html>{0} signature data objects:</html>
message.retries=<html>{0} tries left</html>
message.overwrite=<html>Overwrite {0}?</html>
message.help=<html>Help topic {0}</html>
+warning.xhtml=<html>Remark: This is a preview of the data to-be signed. For standards compliant display see help.</html>
label.pin=<html>{0}:</html>
label.pinsize=<html>({0} digits)</html>
button.ok=OK
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
index 0d2712dd..bc4bdb97 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
@@ -32,15 +32,15 @@ import org.junit.Test;
*
* @author clemens
*/
-//@Ignore
+@Ignore
public class BKUGUITest {
@Test
public void testBKUGUI() {
JFrame testFrame = new JFrame("BKUGUITest");
Container contentPane = testFrame.getContentPane();
- contentPane.setPreferredSize(new Dimension(380, 150));
- BKUGUIFacade gui = BKUGUIFactory.createGUI(contentPane, null, BKUGUIFacade.Style.advanced, null, null);
+ contentPane.setPreferredSize(new Dimension(190, 130));
+ BKUGUIFacade gui = BKUGUIFactory.createGUI(contentPane, null, BKUGUIFacade.Style.simple, null, null);
BKUGUIWorker worker = new BKUGUIWorker();
worker.init(gui);
testFrame.pack();
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
index fec097f5..4d97f9fb 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java
@@ -147,10 +147,13 @@ public class BKUGUIWorker implements Runnable {
//
// Thread.sleep(2000);
//
- gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
+// gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
//
// Thread.sleep(4000);
//
+
+ gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, null, null);
+
// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata");
//
// Thread.sleep(2000);