From 598f62c5b30d6e40f6983fc3eec17613d19cdc0e Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 25 Aug 2009 12:49:43 +0000 Subject: [#436] resolve "#pin digits" message via resource bundle (now, all dialogs - not only pinactivation - get pinLength from resource bundle) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@472 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 17 +++------------ .../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 11 +++------- .../resources/at/gv/egiz/smcc/ACOSCard.properties | 6 +++--- .../at/gv/egiz/smcc/STARCOSCard.properties | 4 ++-- .../bku/smccstal/ManagementPINProviderFactory.java | 24 ++++------------------ 5 files changed, 15 insertions(+), 47 deletions(-) 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 2663e8bf..5ea2499a 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 @@ -580,11 +580,7 @@ public class BKUGUIImpl implements BKUGUIFacade { JLabel pinsizeLabel = new JLabel(); pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, pinsizeLabel.getFont().getSize()-2)); - String pinsizePattern = getMessage(LABEL_PINSIZE); - String pinSize = (pinSpec.getMaxLength() > pinSpec.getMinLength()) ? - pinSpec.getMinLength() + "-" + pinSpec.getMaxLength() : - String.valueOf(pinSpec.getMinLength()); - pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); + pinsizeLabel.setText(MessageFormat.format(getMessage(LABEL_PINSIZE), pinSpec.getLocalizedLength())); GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); @@ -750,11 +746,8 @@ public class BKUGUIImpl implements BKUGUIFacade { } String msgPattern = getMessage(MESSAGE_ENTERPIN_PINPAD); - String pinSize = (pinSpec.getMaxLength() > pinSpec.getMinLength()) ? - pinSpec.getMinLength() + "-" + pinSpec.getMaxLength() : - String.valueOf(pinSpec.getMinLength()); String msg = MessageFormat.format(msgPattern, new Object[] { - pinSpec.getLocalizedName(), pinSize }); + pinSpec.getLocalizedName(), pinSpec.getLocalizedLength() }); JLabel msgLabel = new JLabel(); msgLabel.setFont(msgLabel.getFont().deriveFont(msgLabel.getFont().getStyle() & ~Font.BOLD)); @@ -902,11 +895,7 @@ public class BKUGUIImpl implements BKUGUIFacade { JLabel pinsizeLabel = new JLabel(); pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, pinsizeLabel.getFont().getSize()-2)); - String pinsizePattern = getMessage(LABEL_PINSIZE); - String pinSize = (pinSpec.getMaxLength() > pinSpec.getMinLength()) ? - pinSpec.getMinLength() + "-" + pinSpec.getMaxLength() : - String.valueOf(pinSpec.getMinLength()); - pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); + pinsizeLabel.setText(MessageFormat.format(getMessage(LABEL_PINSIZE), pinSpec.getLocalizedLength())); GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java index e9065d51..9c698d79 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java @@ -298,13 +298,9 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac @Override public void run() { - String HELP_TOPIC, TITLE, MESSAGE_MGMT, MESSAGE_MGMT_PARAM, PINSIZE; + String HELP_TOPIC, TITLE, MESSAGE_MGMT, MESSAGE_MGMT_PARAM; HELP_TOPIC = HELP_PINMGMT; - PINSIZE = (pinSpec.getMaxLength() > pinSpec.getMinLength()) ? - pinSpec.getMinLength() + "-" + pinSpec.getMaxLength() : - String.valueOf(pinSpec.getMinLength()); - if (retries < 0) { if (type == DIALOG.CHANGE) { log.debug("show change pin dialog"); @@ -315,7 +311,6 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac TITLE = TITLE_ACTIVATE_PIN; MESSAGE_MGMT = MESSAGE_ACTIVATE_PIN; oldPinField = null; - PINSIZE = pinSpec.getLocalizedLength(); } else if (type == DIALOG.VERIFY) { log.debug("show verify pin dialog"); TITLE = TITLE_VERIFY_PIN; @@ -388,7 +383,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac pinpadLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD)); String pinpadPattern = getMessage(MESSAGE_VERIFYPIN_PINPAD); pinpadLabel.setText(MessageFormat.format(pinpadPattern, - new Object[] { pinSpec.getLocalizedName(), PINSIZE })); + new Object[] { pinSpec.getLocalizedName(), pinSpec.getLocalizedLength() })); pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(pinpadLabel); @@ -483,7 +478,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac JLabel pinsizeLabel = new JLabel(); pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~Font.BOLD, pinsizeLabel.getFont().getSize()-2)); String pinsizePattern = getMessage(LABEL_PINSIZE); - pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{PINSIZE})); + pinsizeLabel.setText(MessageFormat.format(pinsizePattern, pinSpec.getLocalizedLength())); //////////////////////////////////////////////////////////////// // NON-PINPAD SPECIFIC LAYOUT SECTION diff --git a/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties b/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties index 2e032d1b..15f5c990 100644 --- a/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties +++ b/smcc/src/main/resources/at/gv/egiz/smcc/ACOSCard.properties @@ -17,8 +17,8 @@ # and open the template in the editor. dec.pin.name=Geheimhaltungs-PIN -dec.pin.length=4 +dec.pin.length=0-8 sig.pin.name=Signatur-PIN -sig.pin.length=6 +sig.pin.length=0-8 inf.pin.name=Infobox-PIN -inf.pin.length=4 +inf.pin.length=0-8 diff --git a/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard.properties b/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard.properties index ae91f265..122d2aa7 100644 --- a/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard.properties +++ b/smcc/src/main/resources/at/gv/egiz/smcc/STARCOSCard.properties @@ -17,6 +17,6 @@ # and open the template in the editor. sig.pin.name=Signatur-PIN -sig.pin.length=6 +sig.pin.length=6-12 card.pin.name=Karten-PIN -card.pin.length=4 +card.pin.length=4-12 diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/ManagementPINProviderFactory.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/ManagementPINProviderFactory.java index 34bcbf5c..493733b8 100644 --- a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/ManagementPINProviderFactory.java +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/ManagementPINProviderFactory.java @@ -132,35 +132,19 @@ public class ManagementPINProviderFactory extends PINProviderFactory { } else if (type == PINManagementGUIFacade.DIALOG.VERIFY) { title = PINManagementGUIFacade.TITLE_VERIFY_PIN; message = BKUGUIFacade.MESSAGE_ENTERPIN_PINPAD; - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } - params = new Object[]{pinSpec.getLocalizedName(), pinSize}; + params = new Object[]{pinSpec.getLocalizedName(), pinSpec.getLocalizedLength()}; } else if (type == PINManagementGUIFacade.DIALOG.ACTIVATE) { title = PINManagementGUIFacade.TITLE_ACTIVATE_PIN; message = PINManagementGUIFacade.MESSAGE_ACTIVATEPIN_PINPAD; - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } - params = new Object[]{pinSpec.getLocalizedName(), pinSize}; + params = new Object[]{pinSpec.getLocalizedName(), pinSpec.getLocalizedLength()}; } else if (type == PINManagementGUIFacade.DIALOG.CHANGE) { title = PINManagementGUIFacade.TITLE_CHANGE_PIN; message = PINManagementGUIFacade.MESSAGE_CHANGEPIN_PINPAD; - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } - params = new Object[]{pinSpec.getLocalizedName(), pinSize}; + params = new Object[]{pinSpec.getLocalizedName(), pinSpec.getLocalizedLength()}; } else { //if (type == DIALOG.UNBLOCK) { title = PINManagementGUIFacade.TITLE_UNBLOCK_PIN; message = PINManagementGUIFacade.MESSAGE_UNBLOCKPIN_PINPAD; - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } - params = new Object[]{pinSpec.getLocalizedName(), pinSize}; + params = new Object[]{pinSpec.getLocalizedName(), pinSpec.getLocalizedLength()}; } gui.showMessageDialog(title, message, params); } -- cgit v1.2.3