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 --- .../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 + 4 files changed, 152 insertions(+), 168 deletions(-) (limited to 'BKUCommonGUI/src') 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} -- cgit v1.2.3