diff options
3 files changed, 157 insertions, 147 deletions
diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUI.java index 3fb0bde4..0103bbb1 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUI.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUI.java @@ -98,52 +98,10 @@ public class GetCertificateGUI extends CardMgmtGUI implements cancelButton.setActionCommand(cancelCmd); cancelButton.addActionListener(cancelListener); cancelButton.setEnabled(true); + + updateMethodToRunAtResize("at.gv.egiz.bku.gui.GetCertificateGUI", "renderGetCertificateFrame"); - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - //--------------------------------------------------------------------------------------------------------- - - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.CENTER) - .addGroup(mainPanelLayout.createSequentialGroup() - .addContainerGap() - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() - .addComponent(getQualCertButton, GroupLayout.DEFAULT_SIZE, - GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGap(12)) - .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() - .addGap(1) - .addComponent(getSimCertButton, GroupLayout.DEFAULT_SIZE, - getQualCertButton.getSize().width, Short.MAX_VALUE) - .addContainerGap()))) - ); - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(mainPanelLayout.createSequentialGroup() - .addContainerGap() - .addComponent(getSimCertButton, GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(getQualCertButton, GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE) - )); - - mainPanel.setLayout(mainPanelLayout); - //--------------------------------------------------------------------------------------------------------- - - - GroupLayout.ParallelGroup buttonHorizontal = buttonPanelLayout - .createParallelGroup(GroupLayout.Alignment.CENTER) - .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); - - GroupLayout.Group buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(cancelButton); - - buttonPanelLayout.setHorizontalGroup(buttonHorizontal); - buttonPanelLayout.setVerticalGroup(buttonVertical); - - + renderGetCertificateFrame(); if (windowCloseAdapter != null) { windowCloseAdapter.registerListener(cancelListener, cancelCmd); @@ -156,6 +114,53 @@ public class GetCertificateGUI extends CardMgmtGUI implements }); } + public void renderGetCertificateFrame() { + +//--------------------------------------------------------------------------------------------------------- + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.CENTER) + .addGroup(mainPanelLayout.createSequentialGroup() + .addContainerGap() + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() + .addComponent(getQualCertButton, 0, + GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(12)) + .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup() + .addGap(1) + .addComponent(getSimCertButton, 0, + getQualCertButton.getSize().width, Short.MAX_VALUE) + .addContainerGap()))) + ); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(mainPanelLayout.createSequentialGroup() + .addContainerGap() + .addComponent(getSimCertButton, GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(getQualCertButton, GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE) + )); + + mainPanel.setLayout(mainPanelLayout); +//--------------------------------------------------------------------------------------------------------- + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + + GroupLayout.ParallelGroup buttonHorizontal = buttonPanelLayout + .createParallelGroup(GroupLayout.Alignment.CENTER) + .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + + GroupLayout.Group buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(cancelButton); + + buttonPanelLayout.setHorizontalGroup(buttonHorizontal); + buttonPanelLayout.setVerticalGroup(buttonVertical); + + buttonPanel.setLayout(buttonPanelLayout); + } + @Override public void resize() { @@ -177,6 +182,12 @@ public class GetCertificateGUI extends CardMgmtGUI implements } + if (cancelButton != null) { + + cancelButton.setFont(cancelButton.getFont().deriveFont( + (float) (baseFontSize * factor))); + + } super.resize(); } diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUI.java index 1088545d..bcfac512 100644 --- a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUI.java +++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUI.java @@ -90,9 +90,7 @@ public class GetHardwareInfoGUI extends CardMgmtGUI implements backButton.setActionCommand(backcmd); backButton.addActionListener(hardwareinfolistener); backButton.setEnabled(true); - - //------------------------------------------------------------------------------------ - + readerpanel_border = new TitledBorder(null, getMessage(LABEL_CARDREADER), TitledBorder.LEADING, TitledBorder.TOP, null, null); readerpanel_border.setTitleFont(readerpanel_border.getTitleFont().deriveFont( readerpanel_border.getTitleFont().getStyle() @@ -100,8 +98,6 @@ public class GetHardwareInfoGUI extends CardMgmtGUI implements readerpanel = new JPanel(); readerpanel.setBorder(readerpanel_border); - - cardpanel_border = new TitledBorder(null, getMessage(LABEL_SMARTCARD), TitledBorder.LEADING, TitledBorder.TOP, null, null); cardpanel_border.setTitleFont(cardpanel_border.getTitleFont().deriveFont( cardpanel_border.getTitleFont().getStyle() @@ -111,31 +107,12 @@ public class GetHardwareInfoGUI extends CardMgmtGUI implements cardpanel.setFont(cardpanel.getFont().deriveFont( cardpanel.getFont().getStyle() & java.awt.Font.BOLD)); - - GroupLayout gl_contentPane = new GroupLayout(mainPanel); - gl_contentPane.setHorizontalGroup( - gl_contentPane.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(gl_contentPane.createSequentialGroup() - .addContainerGap() - .addGroup(gl_contentPane.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(cardpanel, GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE) - .addComponent(readerpanel, GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE))) - ); - gl_contentPane.setVerticalGroup( - gl_contentPane.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(gl_contentPane.createSequentialGroup() - .addComponent(readerpanel, GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE) - .addGap(8) - .addComponent(cardpanel, GroupLayout.PREFERRED_SIZE, 89, Short.MAX_VALUE) - .addContainerGap()) - ); - + lblTyp = new JLabel(getMessage(LABEL_SMARTCARD_TYPE)); lblTyp.setFont(lblTyp.getFont().deriveFont( lblTyp.getFont().getStyle() & java.awt.Font.BOLD)); - lblAtr = new JLabel(getMessage(LABEL_SMARTCARD_ATR)); lblAtr.setFont(lblAtr.getFont().deriveFont( lblAtr.getFont().getStyle() @@ -145,86 +122,28 @@ public class GetHardwareInfoGUI extends CardMgmtGUI implements lblNewLabel_1.setFont(lblNewLabel_1.getFont().deriveFont( lblNewLabel_1.getFont().getStyle() & ~java.awt.Font.BOLD)); - - + lblNewLabel_2 = new JLabel(makeATRString(showsmartcardATR, 40)); lblNewLabel_2.setVerticalAlignment(SwingConstants.CENTER); lblNewLabel_2.setFont(lblNewLabel_2.getFont().deriveFont( lblNewLabel_2.getFont().getStyle() & ~java.awt.Font.BOLD)); - GroupLayout gl_cardpanel = new GroupLayout(cardpanel); - gl_cardpanel.setHorizontalGroup( - gl_cardpanel.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(gl_cardpanel.createSequentialGroup() - .addContainerGap() - .addGroup(gl_cardpanel.createParallelGroup(GroupLayout.Alignment.TRAILING) - .addComponent(lblTyp, GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE) - .addComponent(lblAtr, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(ComponentPlacement.UNRELATED) - .addGroup(gl_cardpanel.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(lblNewLabel_1, GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE) - .addComponent(lblNewLabel_2, GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE))) - ); - gl_cardpanel.setVerticalGroup( - gl_cardpanel.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(gl_cardpanel.createSequentialGroup() - .addGroup(gl_cardpanel.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addGroup(gl_cardpanel.createSequentialGroup() - .addGap(2) - .addComponent(lblTyp, GroupLayout.DEFAULT_SIZE, 21, Short.MAX_VALUE)) - .addComponent(lblNewLabel_1, GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)) - .addPreferredGap(ComponentPlacement.RELATED) - .addGroup(gl_cardpanel.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(lblNewLabel_2, GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE) - .addGroup(gl_cardpanel.createSequentialGroup() - .addComponent(lblAtr, GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE) - .addGap(6))) - .addGap(3)) - ); - cardpanel.setLayout(gl_cardpanel); - lblNewLabel = new JLabel(showcardreadername); lblNewLabel.setVerticalAlignment(SwingConstants.CENTER); lblNewLabel.setFont(lblNewLabel.getFont().deriveFont( lblNewLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - GroupLayout gl_readerpanel = new GroupLayout(readerpanel); - gl_readerpanel.setHorizontalGroup( - gl_readerpanel.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(gl_readerpanel.createSequentialGroup() - .addContainerGap() - .addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 276, Short.MAX_VALUE)) - ); - gl_readerpanel.setVerticalGroup( - gl_readerpanel.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(lblNewLabel, GroupLayout.DEFAULT_SIZE, 15, Short.MAX_VALUE) - ); - readerpanel.setLayout(gl_readerpanel); - mainPanel.setLayout(gl_contentPane); - - //------------------------------------------------------------------------------------ - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - GroupLayout.ParallelGroup buttonHorizontal = buttonPanelLayout - .createParallelGroup(GroupLayout.Alignment.CENTER) - .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); - - GroupLayout.Group buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(backButton); - - - buttonPanelLayout.setHorizontalGroup(buttonHorizontal); - buttonPanelLayout.setVerticalGroup(buttonVertical); - if (windowCloseAdapter != null) { windowCloseAdapter.registerListener(hardwareinfolistener, backcmd); } + updateMethodToRunAtResize("at.gv.egiz.bku.gui.GetHardwareInfoGUI", "renderHardwareInfoFrame"); + + renderHardwareInfoFrame(); + contentPanel.validate(); resize(); @@ -232,6 +151,93 @@ public class GetHardwareInfoGUI extends CardMgmtGUI implements }); } + public void renderHardwareInfoFrame() { + + GroupLayout gl_contentPane = new GroupLayout(mainPanel); + gl_contentPane.setHorizontalGroup( + gl_contentPane.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() + .addContainerGap() + .addGroup(gl_contentPane.createParallelGroup(GroupLayout.Alignment.LEADING) +// .addComponent(cardpanel, GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE) +// .addComponent(readerpanel, GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE))) + .addComponent(cardpanel, 0, 298, Short.MAX_VALUE) + .addComponent(readerpanel, 0, 298, Short.MAX_VALUE))) + ); + gl_contentPane.setVerticalGroup( + gl_contentPane.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(gl_contentPane.createSequentialGroup() +// .addComponent(readerpanel, GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE) +// .addGap(8) +// .addComponent(cardpanel, GroupLayout.PREFERRED_SIZE, 89, Short.MAX_VALUE) + .addComponent(readerpanel, 0, 45, Short.MAX_VALUE) + .addGap(8) + .addComponent(cardpanel, 0, 89, Short.MAX_VALUE) + .addContainerGap()) + ); + + GroupLayout gl_cardpanel = new GroupLayout(cardpanel); + gl_cardpanel.setHorizontalGroup( + gl_cardpanel.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(gl_cardpanel.createSequentialGroup() + .addContainerGap() + .addGroup(gl_cardpanel.createParallelGroup(GroupLayout.Alignment.TRAILING) + .addComponent(lblTyp, GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE) + .addComponent(lblAtr, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(ComponentPlacement.UNRELATED) + .addGroup(gl_cardpanel.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(lblNewLabel_1, GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE) + .addComponent(lblNewLabel_2, GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE))) + ); + gl_cardpanel.setVerticalGroup( + gl_cardpanel.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(gl_cardpanel.createSequentialGroup() + .addGroup(gl_cardpanel.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addGroup(gl_cardpanel.createSequentialGroup() + .addGap(2) + .addComponent(lblTyp, GroupLayout.DEFAULT_SIZE, 21, Short.MAX_VALUE)) + .addComponent(lblNewLabel_1, GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)) + .addPreferredGap(ComponentPlacement.RELATED) + .addGroup(gl_cardpanel.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(lblNewLabel_2, GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE) + .addGroup(gl_cardpanel.createSequentialGroup() + .addComponent(lblAtr, GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE) + .addGap(6))) + .addGap(3)) + ); + cardpanel.setLayout(gl_cardpanel); + + GroupLayout gl_readerpanel = new GroupLayout(readerpanel); + gl_readerpanel.setHorizontalGroup( + gl_readerpanel.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(gl_readerpanel.createSequentialGroup() + .addContainerGap() + .addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 276, Short.MAX_VALUE)) + ); + gl_readerpanel.setVerticalGroup( + gl_readerpanel.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(lblNewLabel, GroupLayout.DEFAULT_SIZE, 15, Short.MAX_VALUE) + ); + readerpanel.setLayout(gl_readerpanel); + mainPanel.setLayout(gl_contentPane); + + //------------------------------------------------------------------------------------ + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + GroupLayout.ParallelGroup buttonHorizontal = buttonPanelLayout + .createParallelGroup(GroupLayout.Alignment.CENTER) + .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + + GroupLayout.Group buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(backButton); + + + buttonPanelLayout.setHorizontalGroup(buttonHorizontal); + buttonPanelLayout.setVerticalGroup(buttonVertical); + } + @Override public void resize() { diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GETHardwareInfoRequestHandler.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GETHardwareInfoRequestHandler.java index d2b3b050..4e7fec6c 100644 --- a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GETHardwareInfoRequestHandler.java +++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GETHardwareInfoRequestHandler.java @@ -27,6 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import at.gv.egiz.bku.gui.GetHardwareInfoGUIFacade; +import at.gv.egiz.smcc.SignatureCardException; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.ext.GETHardwareInfoRequest; @@ -54,23 +55,14 @@ public class GETHardwareInfoRequestHandler extends AbstractRequestHandler { if (request instanceof GETHardwareInfoRequest) { - try { - String terminal = card.getTerminalName(); - String smartcard = card.toString(); - String smartcard_ATR = toString(card.getCard().getATR().getBytes()); - - } catch (SignatureCardException e) { - log.error("Some error occur during card communication.", e); - gui.showErrorDialog(GetHardwareInfoGUIFacade.ERR_CARD_NOTACTIVATED, - null, this, "cancel"); - } - - - GetHardwareInfoGUIFacade gui = (GetHardwareInfoGUIFacade) this.gui; + String terminal = card.getTerminalName(); + String smartcard = card.toString(); + String smartcard_ATR = toString(card.getCard().getATR().getBytes()); + gui.showHardwareInfoDialog(this, "back", terminal, smartcard, smartcard_ATR); - + while (true) { waitForAction(); @@ -83,6 +75,7 @@ public class GETHardwareInfoRequestHandler extends AbstractRequestHandler { log.info("unknown command resolved."); } } + } return new GETHardwareInfoResponse(); } |