From e9cfce38bb295d47459c8d976aa9a720719cfb75 Mon Sep 17 00:00:00 2001 From: tkellner Date: Mon, 2 Apr 2012 16:39:00 +0000 Subject: modify the GUI rendering @ Hardware-Info Panel @ Get-Certificate Panel git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1043 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../java/at/gv/egiz/bku/gui/GetCertificateGUI.java | 101 +++++++----- .../at/gv/egiz/bku/gui/GetHardwareInfoGUI.java | 182 +++++++++++---------- 2 files changed, 150 insertions(+), 133 deletions(-) (limited to 'BKUGuiExt/src/main/java/at') 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() { -- cgit v1.2.3