summaryrefslogtreecommitdiff
path: root/BKUCommonGUI/src
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-10-09 16:23:52 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2008-10-09 16:23:52 +0000
commitf993d336e51b9f7898aeeff2e5ae6785066d1e5b (patch)
tree3e8e976954775ec250b878bdfcdaf0eb4769efc7 /BKUCommonGUI/src
parent61ca2c1fe936408ae1b90d52928ce0d90f9a14ac (diff)
downloadmocca-f993d336e51b9f7898aeeff2e5ae6785066d1e5b.tar.gz
mocca-f993d336e51b9f7898aeeff2e5ae6785066d1e5b.tar.bz2
mocca-f993d336e51b9f7898aeeff2e5ae6785066d1e5b.zip
demo integration beta1
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@94 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUCommonGUI/src')
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java7
-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/ImagePanel.java37
-rw-r--r--BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java38
-rw-r--r--BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties2
-rw-r--r--BKUCommonGUI/src/main/resources/images/mocca.pngbin0 -> 1450 bytes
-rw-r--r--BKUCommonGUI/src/main/resources/images/mocca_default.pngbin0 -> 1287 bytes
-rw-r--r--BKUCommonGUI/src/main/resources/images/mocca_tiny.pngbin0 -> 1025 bytes
-rw-r--r--BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java2
9 files changed, 71 insertions, 18 deletions
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
index 636a9fef..53ec1088 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUI.java
@@ -36,6 +36,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
import java.text.MessageFormat;
import java.util.List;
import java.util.Locale;
@@ -127,7 +128,7 @@ public class BKUGUI implements BKUGUIFacade {
* @param localeString may be null
*/
@Override
- public void init(final Container contentPane, String localeString) {
+ public void init(final Container contentPane, String localeString, final URL background) {
if (localeString != null) {
messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString));
@@ -149,7 +150,7 @@ public class BKUGUI implements BKUGUIFacade {
log.debug("initializing gui");
// initIconPanel();
- initContentPanel();
+ initContentPanel(background);
GroupLayout layout = new GroupLayout(contentPane);
contentPane.setLayout(layout);
@@ -189,7 +190,7 @@ public class BKUGUI implements BKUGUIFacade {
// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //);
// }
- protected void initContentPanel() {
+ protected void initContentPanel(URL background) {
contentPanel = new JPanel();
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
index 32eb4c3e..4925e7fa 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java
@@ -20,6 +20,7 @@ import at.gv.egiz.stal.HashDataInput;
import at.gv.egiz.smcc.PINSpec;
import java.awt.Container;
import java.awt.event.ActionListener;
+import java.net.URL;
import java.util.List;
public interface BKUGUIFacade {
@@ -32,7 +33,7 @@ public interface BKUGUIFacade {
public static final String ERR_WRITE_HASHDATA = "error.write.hashdata";
public static final String ERR_INVALID_HASH = "error.invalid.hash";
- public void init(Container contentPane, String localeString);
+ public void init(Container contentPane, String localeString, URL background);
public void showWelcomeDialog();
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java
new file mode 100644
index 00000000..e9c270ce
--- /dev/null
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/ImagePanel.java
@@ -0,0 +1,37 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package at.gv.egiz.bku.gui;
+
+import java.awt.Graphics;
+import java.awt.Image;
+import java.net.URL;
+import javax.swing.ImageIcon;
+import javax.swing.JPanel;
+
+/**
+ *
+ * @author clemens
+ */
+public class ImagePanel extends JPanel {
+
+ protected Image backgroundImg;
+
+ public ImagePanel(URL background) {
+ this(new ImageIcon(background).getImage());
+ }
+
+ public ImagePanel(Image img) {
+ this.backgroundImg = img;
+ this.setOpaque(false);
+ }
+
+ @Override
+ public void paintComponent(Graphics g) {
+ super.paintComponent(g);
+ g.drawImage(backgroundImg, 0, this.getHeight() - backgroundImg.getHeight(null), null);
+ }
+
+}
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
index b7d86d05..8e32d67e 100644
--- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
+++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SimpleGUI.java
@@ -36,6 +36,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.net.URL;
import java.text.MessageFormat;
import java.util.List;
import java.util.Locale;
@@ -53,6 +54,7 @@ import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.LayoutStyle;
import javax.swing.SwingUtilities;
+import javax.swing.border.TitledBorder;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
import org.apache.commons.logging.Log;
@@ -66,7 +68,7 @@ public class SimpleGUI implements BKUGUIFacade {
private static final Log log = LogFactory.getLog(SimpleGUI.class);
public static final String MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/Messages";
- public static final String LOGO_RESOURCE = "/images/logo.png";
+ public static final String DEFAULT_BACKGROUND = "/images/mocca_default.png"; //logo.png";
public static final String HASHDATA_FONT = "Monospaced";
public static final Color ERROR_COLOR = Color.RED;
public static final Color HYPERLINK_COLOR = Color.BLUE;
@@ -121,13 +123,13 @@ public class SimpleGUI implements BKUGUIFacade {
protected int buttonSize;
private static final int CHECKBOX_WIDTH = new JCheckBox().getPreferredSize().width;
-
+
/**
* @param contentPane
* @param localeString may be null
*/
@Override
- public void init(final Container contentPane, String localeString) {
+ public void init(final Container contentPane, String localeString, final URL background) {
if (localeString != null) {
messages = ResourceBundle.getBundle(MESSAGES_BUNDLE, new Locale(localeString));
@@ -149,7 +151,7 @@ public class SimpleGUI implements BKUGUIFacade {
log.debug("initializing gui");
// initIconPanel();
- initContentPanel();
+ initContentPanel(background);
GroupLayout layout = new GroupLayout(contentPane);
contentPane.setLayout(layout);
@@ -189,13 +191,20 @@ public class SimpleGUI implements BKUGUIFacade {
// .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); //);
// }
- protected void initContentPanel() {
+ protected void initContentPanel(URL background) {
- contentPanel = new JPanel();
+ if (background == null) {
+ background = this.getClass().getResource(DEFAULT_BACKGROUND);
+ }
+ contentPanel = new ImagePanel(background);
+// contentPanel.setBorder(new TitledBorder("content"));
+
// headerPanel = new JPanel();
mainPanel = new JPanel();
- buttonPanel = new JPanel();
+ mainPanel.setOpaque(false);
+ buttonPanel = new JPanel(); // new ImagePanel(LOGO_RESOURCE); //new JPanel();
+ buttonPanel.setOpaque(false);
// headerPanel.setBorder(new TitledBorder("header"));
// mainPanel.setBorder(new TitledBorder("main"));
@@ -487,13 +496,14 @@ public class SimpleGUI implements BKUGUIFacade {
// cancelButton.addActionListener(cancelListener);
JButton okButton = new JButton();
+ okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD));
okButton.setText(messages.getString(BUTTON_OK));
okButton.setEnabled(false);
okButton.setActionCommand(okCommand);
okButton.addActionListener(okListener);
JLabel cardPinLabel = new JLabel();
- cardPinLabel.setFont(cardPinLabel.getFont().deriveFont(cardPinLabel.getFont().getStyle() | java.awt.Font.BOLD));
+ cardPinLabel.setFont(cardPinLabel.getFont().deriveFont(cardPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
String pinLabel = messages.getString(LABEL_PIN);
cardPinLabel.setText(MessageFormat.format(pinLabel, new Object[]{pinSpec.getLocalizedName()}));
@@ -513,8 +523,8 @@ public class SimpleGUI implements BKUGUIFacade {
});
JLabel infoLabel = new JLabel();
+ infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD, infoLabel.getFont().getSize()-2));
if (numRetries < 0) {
- infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
String pinsizePattern = messages.getString(LABEL_PINSIZE);
String pinSize = String.valueOf(pinSpec.getMinLength());
if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
@@ -658,13 +668,14 @@ public class SimpleGUI implements BKUGUIFacade {
// cancelButton.addActionListener(cancelListener);
JButton signButton = new JButton();
+ signButton.setFont(signButton.getFont().deriveFont(signButton.getFont().getStyle() & ~java.awt.Font.BOLD));
signButton.setText(messages.getString(BUTTON_SIGN));
signButton.setEnabled(false);
signButton.setActionCommand(signCommand);
signButton.addActionListener(signListener);
JLabel signPinLabel = new JLabel();
- signPinLabel.setFont(signPinLabel.getFont().deriveFont(signPinLabel.getFont().getStyle() | java.awt.Font.BOLD));
+ signPinLabel.setFont(signPinLabel.getFont().deriveFont(signPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
String pinLabel = messages.getString(LABEL_PIN);
signPinLabel.setText(MessageFormat.format(pinLabel, new Object[]{pinSpec.getLocalizedName()}));
@@ -684,7 +695,7 @@ public class SimpleGUI implements BKUGUIFacade {
//pinsize or error label
JLabel infoLabel = new JLabel();
- infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD));
+ infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD, infoLabel.getFont().getSize()-2));
if (numRetries < 0) {
String pinsizePattern = messages.getString(LABEL_PINSIZE);
String pinSize = String.valueOf(pinSpec.getMinLength());
@@ -721,7 +732,7 @@ public class SimpleGUI implements BKUGUIFacade {
.addComponent(signPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
// .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
- .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(infoLabel));
mainPanelLayout.setVerticalGroup(
@@ -847,6 +858,7 @@ public class SimpleGUI implements BKUGUIFacade {
.addComponent(errorMsgLabel));
JButton okButton = new JButton();
+ okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD));
okButton.setText(messages.getString(BUTTON_OK));
okButton.setActionCommand(okCommand);
okButton.addActionListener(okListener);
@@ -1062,6 +1074,7 @@ public class SimpleGUI implements BKUGUIFacade {
// mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(mainPanelLayout.createSequentialGroup().addComponent(refIdLabel).addGap(refIdLabel.getFont().getSize()).addComponent(hashDataScrollPane).addGap(refIdLabel.getFont().getSize())));
JButton backButton = new JButton();
+ backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD));
backButton.setText(messages.getString(BUTTON_BACK));
backButton.setActionCommand(cancelCommand);
backButton.addActionListener(cancelListener);
@@ -1215,6 +1228,7 @@ public class SimpleGUI implements BKUGUIFacade {
JButton backButton = new JButton();
+ backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle() & ~java.awt.Font.BOLD));
backButton.setText(messages.getString(BUTTON_BACK));
backButton.setActionCommand(cancelCommand);
backButton.addActionListener(cancelListener);
diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
index a2b5e0df..abed420f 100644
--- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
+++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties
@@ -34,7 +34,7 @@ message.hashdatalist=<html>{0} Signaturdatenobjekte:</html>
message.retries=<html>Noch {0} Versuch(e)</html>
message.overwrite=<html>M\u00F6chten Sie das existierende Dokument {0} \u00FCberschreiben?</html>
label.pin=<html>{0}:</html>
-label.pinsize=<html>({0} stellig)</html>
+label.pinsize=<html>{0} stellig</html>
button.ok=OK
button.cancel=Abbrechen
button.back=Zur\u00FCck
diff --git a/BKUCommonGUI/src/main/resources/images/mocca.png b/BKUCommonGUI/src/main/resources/images/mocca.png
new file mode 100644
index 00000000..881a65c1
--- /dev/null
+++ b/BKUCommonGUI/src/main/resources/images/mocca.png
Binary files differ
diff --git a/BKUCommonGUI/src/main/resources/images/mocca_default.png b/BKUCommonGUI/src/main/resources/images/mocca_default.png
new file mode 100644
index 00000000..349d9ff0
--- /dev/null
+++ b/BKUCommonGUI/src/main/resources/images/mocca_default.png
Binary files differ
diff --git a/BKUCommonGUI/src/main/resources/images/mocca_tiny.png b/BKUCommonGUI/src/main/resources/images/mocca_tiny.png
new file mode 100644
index 00000000..1f125d9b
--- /dev/null
+++ b/BKUCommonGUI/src/main/resources/images/mocca_tiny.png
Binary files differ
diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
index 5f1bc8b2..308be642 100644
--- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
+++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/BKUGUITest.java
@@ -40,7 +40,7 @@ public class BKUGUITest {
BKUGUI gui = new BKUGUI();
Container contentPane = testFrame.getContentPane();
contentPane.setPreferredSize(new Dimension(380, 150));
- gui.init(contentPane, null);
+ gui.init(contentPane, null, null);
BKUGUIWorker worker = new BKUGUIWorker();
worker.init(gui);
testFrame.pack();