/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package tr.gov.turkiye.esignuidesk.view.pane; import java.text.SimpleDateFormat; import javax.swing.JButton; import tr.gov.turkiye.esign.util.Util; import tr.gov.turkiye.esignuidesk.annotation.FocusOwner; import tr.gov.turkiye.esignuidesk.config.Config; import tr.gov.turkiye.esignuidesk.controller.LogicManager; import tr.gov.turkiye.esignuidesk.data.UserData; import tr.gov.turkiye.esignuidesk.props.ScreenProperties; import tr.gov.turkiye.esignuidesk.support.Utils; /** * Screen 2 * * User agreement and certificate are shown. * * @author iakpolat */ public class CertificateShowScreen extends javax.swing.JPanel { private final int SCREEN_ID=2; /** * Creates new form CertificateShowScreen */ public CertificateShowScreen() { initComponents(); setBounds(Config.DEF_PANEL_STARTING_X, Config.DEF_PANEL_STARTING_Y, Config.DEF_PANEL_WIDTH, Config.DEF_PANEL_HEIGHT); String[] certNames = new String[UserData.certs.size()]; for(int i=0; i<UserData.certs.size(); i++){ certNames[i] = Util.getCN(UserData.certs.get(i).getSubjectDN()); } certTypes.setModel(new javax.swing.DefaultComboBoxModel(certNames)); UserData.slcCertIndex = certTypes.getSelectedIndex(); int ind = UserData.slcCertIndex; certIdentityText.setText(Util.getSerialNumber(UserData.certs.get(ind).getSubjectDN())); certManufacturerText.setText(Util.getCN(UserData.certs.get(ind).getIssuerDN())); certManufacturerText.setToolTipText(Util.getCN(UserData.certs.get(ind).getIssuerDN())); certManufacturerText.setText(Util.getCN(UserData.certs.get(ind).getIssuerDN())); certOwnerText.setText(Util.getCN(UserData.certs.get(ind).getSubjectDN())); startingDateText.setText(Utils.formatDate(UserData.certs.get(ind).getNotBefore())); endDateText.setText(Utils.formatDate(UserData.certs.get(ind).getNotAfter())); } @FocusOwner public JButton getDoneBtn() { return doneBtn; } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { userAgreementPane = new javax.swing.JPanel(); userAgreementScroller = new javax.swing.JScrollPane(); userAgreementArea = new javax.swing.JTextArea(); certPane = new javax.swing.JPanel(); certTypes = new javax.swing.JComboBox(); slcCertLabel = new javax.swing.JLabel(); certInfoPane = new javax.swing.JPanel(); certIdentityLabel = new javax.swing.JLabel(); certOwnerText = new javax.swing.JLabel(); certOwnerLabel = new javax.swing.JLabel(); certIdentityText = new javax.swing.JLabel(); certManufacturerLabel = new javax.swing.JLabel(); endDateLabel = new javax.swing.JLabel(); certManufacturerText = new javax.swing.JLabel(); startingDateLabel = new javax.swing.JLabel(); endDateText = new javax.swing.JLabel(); startingDateText = new javax.swing.JLabel(); backBtn = new javax.swing.JButton(); doneBtn = new javax.swing.JButton(); setLayout(null); userAgreementPane.setBackground(new java.awt.Color(255, 255, 255)); userAgreementPane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); userAgreementPane.setRequestFocusEnabled(false); userAgreementPane.setSize(new java.awt.Dimension(260, 250)); userAgreementPane.setLayout(null); userAgreementArea.setEditable(false); userAgreementArea.setColumns(20); userAgreementArea.setLineWrap(true); userAgreementArea.setRows(5); userAgreementArea.setText(ScreenProperties.getValue("data_to_be_signed") + Utils.getCurrentDate()); userAgreementArea.setWrapStyleWord(true); userAgreementArea.setFocusable(false); userAgreementScroller.setViewportView(userAgreementArea); userAgreementPane.add(userAgreementScroller); userAgreementScroller.setBounds(7, 10, 250, 230); add(userAgreementPane); userAgreementPane.setBounds(0, 0, 260, 250); certPane.setBackground(new java.awt.Color(255, 255, 255)); certPane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); certPane.setSize(new java.awt.Dimension(260, 250)); certPane.setLayout(null); certPane.setName(Config.certPaneName); certPane.add(certTypes); certTypes.setBounds(10, 20, 180, 27); slcCertLabel.setText(ScreenProperties.getValue("choose_certificate")); certPane.add(slcCertLabel); slcCertLabel.setBounds(20, 5, 150, 16); certInfoPane.setBackground(new java.awt.Color(255, 255, 255)); certInfoPane.setBorder(javax.swing.BorderFactory.createEtchedBorder()); certInfoPane.setName(Config.certInfoPaneName); certInfoPane.setLayout(null); certIdentityLabel.setForeground(new java.awt.Color(0, 153, 153)); certIdentityLabel.setText(ScreenProperties.getValue("cert_identity")); certInfoPane.add(certIdentityLabel); certIdentityLabel.setBounds(10, 70, 150, 16); certOwnerText.setText("..."); certInfoPane.add(certOwnerText); certOwnerText.setBounds(10, 25, 210, 16); certOwnerLabel.setForeground(new java.awt.Color(0, 153, 153)); certOwnerLabel.setText(ScreenProperties.getValue("cert_owner")); certInfoPane.add(certOwnerLabel); certOwnerLabel.setBounds(10, 10, 150, 16); certIdentityText.setText("..."); certInfoPane.add(certIdentityText); certIdentityText.setBounds(10, 85, 210, 16); certManufacturerLabel.setForeground(new java.awt.Color(0, 153, 153)); certManufacturerLabel.setText(ScreenProperties.getValue("cert_manufacturer")); certInfoPane.add(certManufacturerLabel); certManufacturerLabel.setBounds(10, 40, 160, 16); endDateLabel.setForeground(new java.awt.Color(0, 153, 153)); endDateLabel.setText(ScreenProperties.getValue("end_date")); certInfoPane.add(endDateLabel); endDateLabel.setBounds(10, 130, 150, 16); certManufacturerText.setText("..."); certInfoPane.add(certManufacturerText); certManufacturerText.setBounds(10, 55, 210, 16); startingDateLabel.setForeground(new java.awt.Color(0, 153, 153)); startingDateLabel.setText(ScreenProperties.getValue("start_date")); certInfoPane.add(startingDateLabel); startingDateLabel.setBounds(10, 100, 150, 16); endDateText.setText("..."); certInfoPane.add(endDateText); endDateText.setBounds(10, 145, 210, 16); startingDateText.setText("..."); certInfoPane.add(startingDateText); startingDateText.setBounds(10, 115, 210, 16); certPane.add(certInfoPane); certInfoPane.setBounds(10, 45, 230, 180); backBtn.setText(ScreenProperties.getValue("back")); backBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { backBtnActionPerformed(evt); } }); certPane.add(backBtn); backBtn.setBounds(50, 225, 70, 25); doneBtn.setText(ScreenProperties.getValue("continue")); doneBtn.setPreferredSize(new java.awt.Dimension(85, 29)); doneBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { doneBtnActionPerformed(evt); } }); certPane.add(doneBtn); doneBtn.setBounds(130, 225, 85, 25); add(certPane); certPane.setBounds(270, 0, 260, 250); }// </editor-fold>//GEN-END:initComponents private void backBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backBtnActionPerformed LogicManager.cancel(Config.CERT_SHOW_SCREEN_ID); }//GEN-LAST:event_backBtnActionPerformed private void doneBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_doneBtnActionPerformed LogicManager.done(Config.CERT_SHOW_SCREEN_ID); }//GEN-LAST:event_doneBtnActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton backBtn; private javax.swing.JLabel certIdentityLabel; private javax.swing.JLabel certIdentityText; private javax.swing.JPanel certInfoPane; private javax.swing.JLabel certManufacturerLabel; private javax.swing.JLabel certManufacturerText; private javax.swing.JLabel certOwnerLabel; private javax.swing.JLabel certOwnerText; private javax.swing.JPanel certPane; private javax.swing.JComboBox certTypes; private javax.swing.JButton doneBtn; private javax.swing.JLabel endDateLabel; private javax.swing.JLabel endDateText; private javax.swing.JLabel slcCertLabel; private javax.swing.JLabel startingDateLabel; private javax.swing.JLabel startingDateText; private javax.swing.JTextArea userAgreementArea; private javax.swing.JPanel userAgreementPane; private javax.swing.JScrollPane userAgreementScroller; // End of variables declaration//GEN-END:variables }